I am working on some code that will check for duplicates after update, but what I am wanting to do is if there is a duplicate to pull up that record. I really don't want to do this with a combo box or list box because my users won't check for duplicates, they are sales people in a hurry. My form is based on a table called "customer TBL" and the form is called "customer FRM". Here is the code that I have so far:
Private Sub HomePhone_AfterUpdate()
Dim Answer As Variant
If DCount("[HomePhone]", "customer tbl", "[homephone] = [Forms]![customer frm]![homephone]") = 1 Then
Answer = MsgBox("This Customer is already in the Database. OK to find existing record", vbOK, "Duplicate!")
If Answer = vbOK Then Cancel = True
Exit Sub
End If
End Sub
It works great, I just need to expand on it. Thanks for the help.
Private Sub HomePhone_AfterUpdate()
Dim Answer As Variant
If DCount("[HomePhone]", "customer tbl", "[homephone] = [Forms]![customer frm]![homephone]") = 1 Then
Answer = MsgBox("This Customer is already in the Database. OK to find existing record", vbOK, "Duplicate!")
If Answer = vbOK Then Cancel = True
Exit Sub
End If
End Sub
It works great, I just need to expand on it. Thanks for the help.