Error code to replace duplicate record error

  • Thread starter Thread starter rick
  • Start date Start date
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
 
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.
 
Back
Top