I am using the following code to validate that the person that is being
entered into the database does not already exist. However wnem I test it
by entering myself as a contact(I first checked that I was indeed NOT in
the database), the message still comes up saying that I am in the
database. what am I doing wrong?
Private Sub txtEmailName_Af terUpdate()
On Error GoTo Err_txtEmailNam e_AfterUpdate
If DLookup("EmailN ame", "Contacts", EmailName = Me >>
txtEmailName.Te xt) > 0 Then
FormattedMsgBox "This person is already in the database. This duplicate
entry will not be added.@The information will now be cleared so that you
may enter new data.@", vbOKOnly + vbInformation, "Duplicate Entry"
cbxFollowedUpBy .Value = ""
cbxFollowUpType .Value = ""
txtspecifyConta cttype.Value = ""
CbxSalutation.V alue = ""
txtFirstName.Va lue = ""
txtLastname.Val ue = ""
cbxCompanyName. Value = ""
cbxPosition.Val ue = ""
txtMobilePhone. Value = ""
txtEmailName.Va lue = ""
txtWorkphone.Va lue = ""
txtWorkext.Valu e = ""
txtFaxNumber.Va lue = ""
End If
Exit_Err_txtEma ilName_AfterUpd ate:
Exit Sub
Err_txtEmailNam e_AfterUpdate:
If Err.Number <> 2001 Then
MsgBox Err.Description
Resume Exit_Err_txtEma ilName_AfterUpd ate
Else
Resume Next
End If
End Sub
thank you
Colin Ward
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!