Setting locked property (1 Viewer)

dan-cat

Registered User.
Local time
Today, 01:16
Joined
Jun 2, 2002
Messages
3,433
I am having trouble setting the lock property of a field to true.
I have a combo field called "Type" in the Main Order form. I want to lock this field whenever there is a record within the Sub Order form. Here is what I have written so far - with ProductCode being the field within the subform.
Private Sub ProductCode_AfterUpdate()
[Forms]![frmOrders]![Type].Locked = True
End Sub
However I get the following error:
"Run-time error - '2166' you can't lock a control whilst it has unsaved changes"
 

mbentley

Registered User.
Local time
Yesterday, 19:16
Joined
Feb 1, 2002
Messages
138
It's probably because the "Type" field is dirty, meaning that the information in it has changed. You probably need to save the changes to the record before you lock the field. Not sure if you necessarily want to do that, but it should work.
 

Users who are viewing this thread

Top Bottom