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"
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"