the object is locked warning (1 Viewer)

benjamin.weizmann

Registered User.
Local time
Yesterday, 21:43
Joined
Aug 30, 2016
Messages
78
hi :)
how can I get rib of this massage:
"this object is locked. any changes you make will be discarded when the form is close"

I know it.. I want it to be like this ... and I don't get this massage


thanks
Ben
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:43
Joined
May 7, 2009
Messages
19,246
do you have ChartObject on the form.
On the Form's Error Event add the code to continue:


Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = 2800 Then _
Response = acDataErrContinue
End Sub
 

isladogs

MVP / VIP
Local time
Today, 05:43
Joined
Jan 14, 2017
Messages
18,258
The important bit of info is the error number.
Doing a quick search of Access error codes shows it is error 2800



There are 2 ways of proceeding.
The first is better, the second may be acceptable

1. Identify the cause of the error and solve it.
Not knowing the context, its hard to advise on a solution

2. Suppress the error message if you're sure its not an issue.
Add error handling to your code and make an exception for error 2800
Tell the code to ignore the error (Resume Next) or exit the sub without a message (Exit Sub)
For example:

Code:
Sub MyProcedureName

On Error GoTo Err_Handler:

...your code goes here

Exit_Handler:
   Exit Sub

Err_Handler:
   If err=2800 Then Resume Next

   MsgBox "Error " & err.Number & " : " & err.Description
   Resume Exit_Handler

End Sub

The same principles apply to ANY error message - always NOTE the error number

BTW - you may find this utility useful: Access Error Codes
Its how I found the error number
 

Attachments

  • Capture.PNG
    Capture.PNG
    19.9 KB · Views: 342

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:43
Joined
May 7, 2009
Messages
19,246
I know it.. I want it to be like this ... and I don't get this massage


point 1, he knows what his doing, and just want to get rid of the message.
 

Users who are viewing this thread

Top Bottom