Error Event

See AlsovbevtErrorSee              ExamplevbevtErrorEx>Low

Applies To

Data control2E1FEX3.

Description

Occurs only as the result of a data access error that occurs when no Visual Basic code is being executed.

Syntax

Sub datacontrol_Error ([Index As Integer,] DataErr As Integer, Response As Integer)

Remarks

The Error event uses these parts:

Part               Description

 

Index             Uniquely identifies a control if it is in a control array.

DataErr          The error number.

Response      A number corresponding to the response you want to take.

 

Constants and values for the Response part are:

Constant                    Value     Description

 

DATA_ERRCONTINUE    0       Continue

DATA_ERRDISPLAY        1       (Default) Display the message

 

These values are from the Visual Basic file CONSTANT.TXT.

You ordinarily provide error-handling functionality for run-time errors in your code.  However, run-time errors can occur when none of your code is running, such as when:

         A user clicks a data control button.

         The data control automatically opens a database and loads a recordset after the Form_Load event.

         A custom control performs an operation such as the MoveNext method, the AddNew method, or the Delete method.

 

If an error results from one of these actions, the Error event occurs.