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 > Exit 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


Exit Event Programming Visual Basic Example

VBA Form Event Examples - Code Samples

Visual Basic On Exit event occurs just before a control loses the focus to another control on the same form.

Access Database On Exit Event Example:

Here we show how to do validation on a the Due_Date field of a form.  The Due_Date is a required field and we want to make sure the user does not leave it blank on exiting.  Using the On Exit event for validation is not fool proof since this event does not always trigger based on the form and field the user is moving to.

Private Sub LastName_Exit(Cancel As Integer)
If isnull(Me.Due_Date)=True then
    Msgbox "The Due Date is a requiired field."
    Me.Due_Date.SetFocus
End If
End Sub

Contact Information

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