ChrisHaynes
Technical User
Hi. I have a register form, which is unbound. When I click the command button to create a new user, it is supposed to use the Dlookup function to check that there aren't any records including the first name and surname in the User table.
However, this doesn't work and the form still add's the record to the table. I have set the field 'username' to the primary key and no duplicates but the form still add the record but just doesn' add a duplicate to the table.
The code I am using is shown below:
Can anyone help?
Thanks,
Chris.
However, this doesn't work and the form still add's the record to the table. I have set the field 'username' to the primary key and no duplicates but the form still add the record but just doesn' add a duplicate to the table.
The code I am using is shown below:
Code:
If DLookup("[First Name]", "tblUsers") = Me![First Name] And DLookup("[Surname]", "tblUsers") = Me![Surname] Then
MsgBox "You Are Already A User", vbOKOnly & vbCritical, "User Already Exists"
DoCmd.Close
Can anyone help?
Thanks,
Chris.