stephenlecomptejr
asked on
Does err = 0 and err.Clear do the same thing? Which one clears the error from the stack?
Within Microsoft Access VBA, if I want to remove an error completely from memory do I use Err = 0 or Err.Clear?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I just tested this and either will work, but err.clear is better.
Doing:
Err = 0
Doesn't clear the error object (ie. the last error description still remains). However it will work as you would think for in-line error handling. i.e.
On Error Resume Next
Err = 0
' Do something
If Err<>0 then
' Error occured
End If
Jim.
Doing:
Err = 0
Doesn't clear the error object (ie. the last error description still remains). However it will work as you would think for in-line error handling. i.e.
On Error Resume Next
Err = 0
' Do something
If Err<>0 then
' Error occured
End If
Jim.
" Doesn't clear the error object (ie. "
Then they are not the same.
"Use Clear to explicitly clear the Err object after an error has been handled, "
mx
Then they are not the same.
"Use Clear to explicitly clear the Err object after an error has been handled, "
mx
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
"so it's hard to say what Err = 0 actually does. "
Which is why I don't use it in this context.
Stephen ... if you want the ultimate error handler, then see this:
http://www.everythingaccess.com/vbwatchdog.htm
And lots of great info in this site ...
mx
Which is why I don't use it in this context.
Stephen ... if you want the ultimate error handler, then see this:
http://www.everythingaccess.com/vbwatchdog.htm
And lots of great info in this site ...
mx
ASKER
Thanks for all the great replies!
I appreciate the comments.
I appreciate the comments.
Either will work.
Jim.