You can use the Err object to obtain information about the error.
The Err object contains information about any run-time errors.
When a run time error occurs, the properties of the Err object are filled with information that uniquely identifies the error and contains information that can be used to handle the error.
Error handling relies on the value in the Number property of the Err object to determine the cause of the error.
|Number||The error number. If this is zero then no error has occurred.|
|Description||A short description of the error|
|Source||The project name from the Properties dialog box.|
|HelpContext||The context ID for a particular error in a help file.|
|HelpFile||A folder location and filename of the help file.|
|LastDllError||A system error code produced by a call to a DLL or external library (ie an APi call)|
The Err object properties are reset to a zero and zero-length strings after an Exit, Resume Next or Goto 0 statement.
The clear method can be used explicitly to reset the properties.
Note The VarType for vberror is 10
The Err object has global scope.
It is possible to pass in an ErrObject into a subroutine but the object will be reset to Empty if an On Error statement is executed.
Call Error_Handle(msModuleName, sSubroutineName, Err)
SS - snippet copy from Error_Handle
When an Error occurs, Visual Basic sets a global error object "Err" which contains information about the error that has occurred
© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext