Trap error 3022 and show the offending field.

R

Ross Colton

Hello,
I have a form with user information that has Indexed (no duplicates)
fields for Login, MainframeID, VPNToken. The problem is, VPN Tokens and
Mainframe IDs get recycled, so new employees can get information assigned to
them that is in another (terminated) employee's record. (I keep terminated
employees in the database so we have some record if they fail to return
their laptops or VPN tokens.) Anyway, when a new employee gets a VPN token
that is still assigned to an old employee, it pops up:

3022: "The changes you requested to the table were not successful because
they would create duplicate values in index, primary key, or relationship.
Change the data in the field or fields that contain duplicate data, remove
the index, or redefine the index to permit duplicate entries and try again."

I've already changed it to something a little more helpful, like:

Case 3022
MsgBox "One of the values you entered created a duplicate entry in
an indexed field." _
& vbCrLf & "Please check to make sure these values aren't used in
another record."

But I would like it to actually find the offending field and alert the user
which one needs to be changed. If this is possible, I will then make the
dialog box also display the user that currently has the value assigned to
them.

Right now all I need to know is how to determine which field is causing the
3022, any ideas?

Thank you,
Ross Colton
(e-mail address removed)
 

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