Event Procedure Examples
Event Procedure visual basic programming tutorials for Microsoft Access. This page provides an overview of our event procedure form programming examples.
In this section we will explain and provide examples for
Microsoft Access event procedures (aka triggers, flags, indicator bits) which occur in MS Access forms.
A form event is an action that is associated with a certain object. MS
Access will trigger a wide range of events: mouse movement or clicks, changes to
data, open or closing forms, and other activities. Events are most often the
consequence of user action.
There are 3 sections of our website devoted to different aspects of form
design and event procedure programming:
We will stick to the most common event procedures you'll need to create interactive forms.
gives you the ability to control all the key functions within Access forms. Many of
these events are used in conjunction to add control over user actions within the
forms and to provide data security and validation.
Event procedures are also called triggers, indicators, flags, and several other names. These event
source code examples show the usage and syntax of the commonly used event procedures.
In Access 2010 Microsoft has expanded Access's functionality by adding a handful
of table-level event triggers. These table events are implemented using
macro coding. Now you can program your databases just like the big boys
using Oracle and SQL/Server!
Below is a table of contents for our Event Procedure Tutorial. Use the
right-side navigation links go to the specific example page.
Event Procedure Examples List
||Event Procedure Example Description
After Insert Event Procedure
||AfterInsert event occurs in VBA after a new
record has been added to the source table.
After Update Event Procedure
||Afterupdate event is triggered and the entire
record is updated and the data is saved in the database.
Before Update Event Procedure
||The beforeupdate event gives you the ability
to review the data entered by the user just before it is stored in the
On Change Event Procedure
||Slow opening MS Access forms can annoy the
user. Program activation can sometimes take more than a minute when using a
On Close Event Procedure
||Visual Basic On Close event occurs when a form
is closed and removed from the screen.
On Current Event Procedure
||The Current event (or On Current event)
activates when the focus moves to a record on the form. This action makes
this record the 'current record'. This event occurs after a form is
opened, re-queried or refreshed
On DblClick Event Procedure
||On DblClick event occurs in VBA when the user
presses and releases the left mouse button two times within the double-click
time limit of the computer.
On Error Event Procedure
||Visual Basic Error event gets flagged when a run-time
error occurs in Access on the current form.
On Exit Event Procedure Help
||Visual Basic On Exit event occurs preceding
the active control losing the focus to another control on the same form.
Timer Event Procedure Programming
||Visual Basic Timer event triggers in a form based
on the setting (in milliseconds) of the Timer Interval form property.
||Visual Basic Undo event occurs when the user
cancels a change to a combo box control, a form, or a text box control.