Error number for duplicate key

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have set up a field as indexed with no duplicates. Does anybody know the error code returned by Access 97 so that I can trap it and return an appropriate message to the user?
 
Use the Error event of the form to trap these values of DataErr:
3022 duplicate index value;
3201 related record required;
2113 wrong data type.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

SHIPP said:
I have set up a field as indexed with no duplicates. Does anybody know the
error code returned by Access 97 so that I can trap it and return an
appropriate message to the user?
 
You sometimes have to wonder, where is people's initiative?

step 1 - enter duplicate record;
step 2 - read error message!

:-)

TC
 
Thanks for the compliment :-)

TC


Allen Browne said:
Yes, it is that simple, except that you cannot trap these errors with normal
VBA error handling, and they are not in Err.Number. The Error event of the
form is less obvious to find, and the DataErr values are not listed (AFAIK).

BTW, TC, you have been posting lots of useful answers for people recently.
Thanks.
 
Yes, it is that simple, except that you cannot trap these errors with normal
VBA error handling, and they are not in Err.Number. The Error event of the
form is less obvious to find, and the DataErr values are not listed (AFAIK).

BTW, TC, you have been posting lots of useful answers for people recently.
Thanks.
 
Back
Top