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