A read/write property containing a numeric value that represents the error code for the last error generated
When a runtime error is generated within the program, the error code is automatically assigned to Err.Number.
The Number property is updated with an application-defined error whose code is passed as an argument to the Err.Raise method.
When using the Err.Raise method in normal code, your user-defined error codes cannot be greater than 65536 nor less that 0. (For an explanation, see the final note in Section of the Err.Raise Method entry.)
VB reserves error numbers in the range of 1-1000 for its own trappable errors. In addition, error numbers from 31001 to 31037 are also used for VB trappable errors. In implementing a series of application-defined errors, your error handlers should either translate application errors into VB trappable errors or, preferably, assign a unique range to application-defined errors.
When using the Err.Raise method in ActiveX objects, add the
(-2147221504) to your user-defined error code to
distinguish OLE errors from local-application errors.
When control returns to the local application after an error has been raised by the OLE server, the application can determine that the error originated in the OLE server and extract the error number with a line of code like the following:
Dim lError as Long If (Err.Number And vbObjectError) ...