error 0

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What is error 0 and why does it not have a description? Should I trap it in
error handlers?
 
0 is the value of Err when there is no error or the Err.Clear has been
executed. I don't suggest that you trap it! ;-)

I'm guessing that you have a procedure that is running into its error
processing section because you don't have an Exit Sub/Function that avoids
the error processing section

E.g. problem code:

Sub Test()
On Error Goto Err_Test

'Normal code here
'
Test_Exit:
'Exit Sub ---- This line commented out will display Error 0 in normal
operation.
Err_Test:
Msgbox "Error " & Err & ": " & Err.Description
Exit Sub
End Sub

Make sure you exit the procedure before you hit the error handler!

HTH,

Kevin
 
thanks.

Kevin K. Sullivan said:
0 is the value of Err when there is no error or the Err.Clear has been
executed. I don't suggest that you trap it! ;-)

I'm guessing that you have a procedure that is running into its error
processing section because you don't have an Exit Sub/Function that avoids
the error processing section

E.g. problem code:

Sub Test()
On Error Goto Err_Test

'Normal code here
'
Test_Exit:
'Exit Sub ---- This line commented out will display Error 0 in normal
operation.
Err_Test:
Msgbox "Error " & Err & ": " & Err.Description
Exit Sub
End Sub

Make sure you exit the procedure before you hit the error handler!

HTH,

Kevin
 
Back
Top