Occurs only as the result of a data access error that takes place when no Visual Basic code is being executed.
Syntax
Private Sub object _Error([index As Integer,]Number As Long, Description As String, Scode As Long, Source As String, HelpFile As String, HelpContext As Long, CancelDisplay As Boolean)
The Error event syntax has these parts:
Part | Description |
object | An object expression that evaluates to an object in the Applies To list. |
index | Identifies the control if it's in a control array. |
Number | The native error number. |
Description | Describes the error. |
Scode | ODBC error return code. |
Source | Source of the error. |
HelpFile | The path to a Help file containing more information on the error. |
HelpContext | The Help file context number. |
CancelDisplay | A number corresponding to the action you want to take, as described in Settings. |
Settings
The settings for CancelDisplay are:
Constant | Value | Description |
rdDataErrContinue | 0 | Continue. |
rdDataErrDisplay | 1 | (Default) Display the error message. |
Remarks
Generally, the Error event arguments correspond to the properties of the rdoError object.
You usually provide error-handling functionality for run-time errors in your code. However, run-time errors can occur when none of your code is running, as when:
If an error results from one of these actions, the Error event occurs.
If you don't code an event procedure for the Error event, Visual Basic displays the message associated with the error.