What I'm trying to do is to re-use the values of err.number and
err.description after displaying them in a MsgBox. The values seem to
auto clear and not be re-usable on a second reference.
For example - if I construct this:
Function ThisFunctionGeneratesAnError()
On Error GoTo ErrorHandler
'code that generates an error
ExitErrorHandler:
Exit Function
ErrorHandler:
msgox err.number & " - " & err.description
call SomeOtherFunction(err.number, err.description)
Resume ExitErrorHandler
End Function
What happens is the message box displays correctly with:
"1234 - Error message text"
but the function SomeOtherFunction is passed the values:
SomeOtherFunction(0,"")
If I reverse the order of the code to:
call SomeOtherFunction(err.number, err.description)
msgox err.number & " - " & err.description
What happens is the function SomeOtherFunction is passed the values
correctly:
SomeOtherFunction(1234,"Error message text")
but the message box appears as:
"0"
Is there a way to avoid this behaviour, without having to construct a
mess that looks like:
....
ErrorHandler:
Dim myErrNumber as long, myErrorText as String
myErrNumber=err.number
myErrorText=err.description
msgox myErrNumber & " - " & myErrorText
call SomeOtherFunction(myErrNumber, myErrorText)
Resume ExitErrorHandler
End Function
Thanks,
lq