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.
 

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

Similar Threads

Duplicate the record in form and subform 23
Set the focus 1
error trapping 3
Access Auto Matching Duplicates? 0
On Error Goto.... 1
Access Indeterminate relationship in many-to-many table (Windows 10, Access 2016) 5
On Error Goto.... 3
Duplicate Keys 1

Back
Top