Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I bypass error 3022 (duplicate values in the index)

Status
Not open for further replies.

ToyFox

Programmer
Jan 24, 2009
161
US
I am linking to a mailbox and have a timer routine that imports new emails into a table every x minutes.
I have the field TASK_RECEIVED set not to allow dupes. I figure the date/time make it unique. I am getting a run-time error 3022 (would create duplicate values in the index) on the next time the routine fires.
That is true, I don't want to see the record imported a second time. How can I by-pass this message,
 
Add some VBA code; if the record already exists, either delete it & import, or don't import.

Ever notice how fast Windows runs? Me neither.
 
By default if its indexed it wont import but access will tell you all about it via the error message

Just add

Docmd.SetWarnings False

Before the import but dont forget to add

Docmd.SetWarnings True when the routine is finished :)

The record will not be added beause it would create duplicates however you wont be notified either. :)

Remember amateurs built the ark - professionals built the Titanic

[flush]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top