Run-time Error 2169

darkhat01

Registered User.
Local time
Today, 04:28
Joined
Oct 13, 2006
Messages
12
I am getting an error because the focus is set to txtExceptionName. This is an id key that is auto generated for a new recored, but I need to lock this field out so no one can change the id once it has been created. but I need a new ID created only if there is a new record being created. Any ideas?



I am getting the following error:

Run-time Error '2169':
You can't disable a control while it has the focus.




Code:

Private Sub Form_Load()

If Application.IsCompiled = True Then
Me!txtPostDate.Enabled = False
Me!btnPostDate.Enabled = False
Me!txtExceptionName.Enabled = False 'Error happens here
End If
End Sub

Thanks,

Darkhat01
 
Use the .Locked property of the text box instead of the .Enabled
 
AutoNumber do not have to be shown on the form. Infact it is best practice not to expose AutoNumbers to users as they might do something silly like use the number on folders etc.
 

Users who are viewing this thread

Back
Top Bottom