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_AfterUpdate()
On Error GoTo Err_txtEmailName_AfterUpdate
If DLookup("EmailName", "Contacts", EmailName = Me >>
txtEmailName.Text) > 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 = ""
txtspecifyContacttype.Value = ""
CbxSalutation.Value = ""
txtFirstName.Value = ""
txtLastname.Value = ""
cbxCompanyName.Value = ""
cbxPosition.Value = ""
txtMobilePhone.Value = ""
txtEmailName.Value = ""
txtWorkphone.Value = ""
txtWorkext.Value = ""
txtFaxNumber.Value = ""
End If
Exit_Err_txtEmailName_AfterUpdate:
Exit Sub
Err_txtEmailName_AfterUpdate:
If Err.Number <> 2001 Then
MsgBox Err.Description
Resume Exit_Err_txtEmailName_AfterUpdate
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!