Hi Everyone! I have this code that executes after the [Last Name] field is updated:
Private Sub Last_Name_AfterUpdate()
DoCmd.RunCommand acCmdSaveRecord
If Not IsNull(DLookup("ID", "[Reg Form]", "[First Name]=Forms![Reg Form]![First Name] AND [Last Name] = Forms![Reg Form]![Last Name]"
) Then
Response = MsgBox("The attendee name you have just entered is a duplicate. Click the 'Search' button now to find the attendee.", vbOKOnly)
End If
End Sub
I get the messagebox to come up when a first name and last name is duplicated - however I also get the message when they are not duplicated! Any ideas on how to correct this code? Thank you!!!
Private Sub Last_Name_AfterUpdate()
DoCmd.RunCommand acCmdSaveRecord
If Not IsNull(DLookup("ID", "[Reg Form]", "[First Name]=Forms![Reg Form]![First Name] AND [Last Name] = Forms![Reg Form]![Last Name]"
Response = MsgBox("The attendee name you have just entered is a duplicate. Click the 'Search' button now to find the attendee.", vbOKOnly)
End If
End Sub
I get the messagebox to come up when a first name and last name is duplicated - however I also get the message when they are not duplicated! Any ideas on how to correct this code? Thank you!!!