troubleshooting Question

On Error GoTo MyErrorRoutine except when error number is 3022

Avatar of Rob4077
Rob4077Flag for Australia asked on
Microsoft Access
7 Comments1 Solution306 ViewsLast Modified:
I have a routine that does a fair amount of work on a table. I need a general error trap in case it encounters an unexpected error, however in just one small section of code I need to have it ignore a .Update command if the error code is 3022 (duplicate key) and just abandon the .Update. Can anyone tell me how to do it?

eg

with MyTable
    .Addnew
    !Value = "My Value"
    !Value2 = "My Other Value"
    .Update    'only in this step of the code, abandon the update if the record has already been added
End With
ASKER CERTIFIED SOLUTION
John Mc Hale
Forensic Computer Examiner, Analyst/Programmer & Database Architect

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros