Hi,
I want to lock a control unless the date in another control has been populated. I thought I'd do this in the 'BeforeUpdate' event, however I'm getting an error. My code is:
Private Sub Field_1_BeforeUpdate(Cancel As Integer)
If IsNull(Me.Field_2) Then
Me.Field_1.Locked = True
MsgBox "MyMsg"
Else
Me.Field_1.Locked = False
End If
End Sub
But, I'm getting "Run-time Error '2166' You can't lock a control while it has unsaved changes" when I try to update Field_1 after updating Field_2.
This error makes sense to me, but any ideas around how else I can get this to work would be appreciated.
Thanks - Kirsti