duplicate entry message

  • Thread starter Thread starter Lauren B
  • Start date Start date
L

Lauren B

I am attempting to code my form so that if a user enters a Customer ID
already in use, they will get a message box that tells them immediately
after leaving the corresponding text box. (as opposed to getting an error
message when attempting to save the entry after fully completing the form).
I am attempting to use the following code in the before update property of
the text box ("TxtBxCustomer_ID"):

DLookUp ("Customer_ID" , "Table1" , Customer_ID = " ' " &
Me.TxtBxCustomer_ID & " ' " then
Msgbox "Duplicate entry. Please make a new selection."

This code is not working. I am not getting an error message, it just simply
is doing nothing. How can I change this code to work properly.

Thank you for any assistance.

LB
 
If not IsNull(DLookUp ("Customer_ID" , "Table1" , Customer_ID = " ' " _
& Me.TxtBxCustomer_ID & " ' " ) then
Msgbox "Duplicate entry. Please make a new selection."
Cancel = True
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top