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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ignore Error?

Status
Not open for further replies.

Woodman650

Technical User
Jan 20, 2005
92
US
Does anyone know if there is a way to ignore an error? I keep getting the error 3021... and I was hoping to just prevent the error from even appearing to the user. I don't know if it's possible, but I can't diagnose the problem and it doesn't seem to be hurting the DB. I just want to ignore it. haha
 
Put this above the code that errors:
Code:
On Error Resume Next

After the code that causes the error, I strongly suggest re-enabling the error handler, i.e. something like:
Code:
On Error Goto MyErrorHandler

Maybe a safer strategy would be to do the following in your error handler:
Code:
MyErrorHandler:
If Err.Number = 3021 Then
    Resume Next
Else
    MsgBox "Warning, error # " & Err.Number & " occurred.  Description of the error is: " & Err.Description
End If
 
Error 3021 is No Current Record and I think it would be better to fix the code a little than to skip the error.
 
I haven't changed anything... and the error has mysteriously dissapeared. =/ weird
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top