Home  Fees/Services  Access Examples  Tutorials  Access Download  Articles  Search  Contact  Privacy  Links
Custom Database Design Consultants
 
Access Programming Examples
 
Access Example Downloads
Access Form Events Access Event Coding Examples
Form Event Programming
Access VBA Events

 Database Tutorials > Form Event Tutorials > Error Event

                               

After Insert Event
After Update Event
Before Update Event
On Change Event
On Close Example
On Current Event
On DblClick Event
On Error Event
On Exit Event Help
VBA Timer Event
Undo Event Method


Access Error Event Example

VBA Form Error Event Examples - Code Samples

Visual Basic Error event arises when a run-time error occurs in Access on the current form.

Error Event Visual Basic Example:

It is good practice to have an On Error event handler in each form.  In this example we simply trap the error and display a message to the userr.

Private Sub Form_Error(DataErr As Integer, Response As Integer)
    Msgbox "An unexpected error has occurred in the form.  " & _
        "The error description is " & err.description
    Response = acDataErrContinue
End Sub

The response argument can have either of two values:

acDataErrContinue:  Ignore the error and continue without displaying the Microsoft Access error message.


acDataErrDisplay:  Display the Microsoft Access error message. This is the default setting.

Contact Information

Event Procedures in MS Access
Microsoft Access 2003 2000 2002(XP) 97 All Windows Versions