The Microsoft Access 2.0 Event Model

The event model for Microsoft Access 2.0 is greatly expanded from Microsoft Access 1.1. The following table gives a quick overview of all the events support by Microsoft Access 2.0:

Event category

Events

Occur when

Window events

Close, Load, Open, Resize, Unload

A user performs an action on a form or report.

Focus events

Activate, Deactivate, Enter, Exit, GotFocus, LostFocus

Objects receive or lose the focus, or become active or inactive.

Data events

AfterDelConfirm, AfterInsert, AfterUpdate, BeforeDelConfirm, BeforeInsert, BeforeUpdate, Change, Current, Delete, NotInList, Updated

Changes occur to records and data.

Mouse events

Click, DblClick, MouseDown, MouseMove, MouseUp

A mouse action, such as a click or double-click, occurs.

Keyboard events

KeyDown, KeyPress, KeyUp

A user types on the keyboard, or keys are sent using the SendKeys action.

Print events

Format, Print, Retreat

A report is being printed or being formatted for printing.

Error and Timing events

Error, Timer

Microsoft Access produces an error, or a specified time interval passes.


We don't have the time to look at each of these events, but we'll examine a few of them in detail with some sample code.