J
Joe Coulter
Please help, I hope this is not too long winded, but I thought that as much
background as possible to clarify what I have.
I have a field "Update_User_ID" on a form "Frm_Update_Receipt" which is used
to validate the Username, this looks up a list of Users "User_ID" in a Table
"Tbl_Users"
I have this Code on the BeforeEvent of the "Update_User_ID" field.
Private Sub Update_User_ID_BeforeUpdate(Cancel As Integer)
If IsNull(DLookup("Update_User_ID", "Tbl_Users", "User_ID ='" &
Me!Update_User_ID & "'")) Then
MsgBox Me!Update_User_ID & " IS AN INVALID USER ID."
Me!Update_User_ID.Undo
Cancel = True
Else:
Me!Date_Sup_Manuf.Visible = True
Me!Btn_Cancel_001.Visible = False
Me!Btn_CANCEL.Visible = True
End If
End Sub
This works great and ensures that only user ids held in the table gains
access to the form and if accepted, the user id is captured.
However, if the User presses the Enter Key when the field is blank, the
focus moves to the only other visible control at that moment
"Btn_Cancel_001", I want to restrict the user from leaving the
"Update_User_ID" Field unless he/she inputs an accepted ID or presses the
Cancel_001 button.
I have tried putting code on the AfterEvent to check for null and return the
focus to the field, this seems to be ignored.
Any help would be greatly appreciated.
Thanks in anticipation
Joe
background as possible to clarify what I have.
I have a field "Update_User_ID" on a form "Frm_Update_Receipt" which is used
to validate the Username, this looks up a list of Users "User_ID" in a Table
"Tbl_Users"
I have this Code on the BeforeEvent of the "Update_User_ID" field.
Private Sub Update_User_ID_BeforeUpdate(Cancel As Integer)
If IsNull(DLookup("Update_User_ID", "Tbl_Users", "User_ID ='" &
Me!Update_User_ID & "'")) Then
MsgBox Me!Update_User_ID & " IS AN INVALID USER ID."
Me!Update_User_ID.Undo
Cancel = True
Else:
Me!Date_Sup_Manuf.Visible = True
Me!Btn_Cancel_001.Visible = False
Me!Btn_CANCEL.Visible = True
End If
End Sub
This works great and ensures that only user ids held in the table gains
access to the form and if accepted, the user id is captured.
However, if the User presses the Enter Key when the field is blank, the
focus moves to the only other visible control at that moment
"Btn_Cancel_001", I want to restrict the user from leaving the
"Update_User_ID" Field unless he/she inputs an accepted ID or presses the
Cancel_001 button.
I have tried putting code on the AfterEvent to check for null and return the
focus to the field, this seems to be ignored.
Any help would be greatly appreciated.
Thanks in anticipation
Joe