Error code to replace duplicate record error

R

rick

Hi,
I was wondering how to best go about error coding my forms
(those where data entry is required) so that if a
duplicate value is entered into a primary key field, I can
display a custom message in replacement of the standard
error message that pops up (blah...blah...would create
duplicate values in the index or primary key). I guess I
am just looking for the best way to check to see if a
similar value exists in the underlying record source. I
can write the rest of the procedure to pop up the msgbox.
I toyed with using dlookup but couldn't get it to work.
Thanks for any help,
-Rick
 
W

Wayne Morgan

You should be able to trap the error in the Form's OnError event so that you
can then pop-up your own error message. In the event you would set Response
= acDataErrContinue to tell Access that you handled the error.
 

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

Top