DoCmd.GoToControl is Working

Novice1

Registered User.
Local time
Yesterday, 19:39
Joined
Mar 9, 2004
Messages
385
I have a form with code on the close button. I run through a few commands to ensure the user has completed the form correctly. The first part of the code below runs correctly. When it runs the second portion, the IF Then works fine but when I try to redirect the user to the blank field (ID_Reason) I'm getting an error, "Run time error 2109. There is no field 'ID_Reason' in the current record. The field is there. The field name is correct. Why is the GoToControl command not working? Any help would be appreciated.

If IsNull(Me![LName]) Then
MsgBox "You must enter your last name", vbInformation, "Mandatory Field"
DoCmd.GoToControl "LName"

Else

If Me.CACorIDcard = "-1" And IsNull(Me![ID_Reason]) Then
MsgBox "You must enter the reason why you need a new ID card", vbInformation, "Mandatory Field"
DoCmd.GoToControl "ID_Reason"
 

Users who are viewing this thread

Back
Top Bottom