Overview
This section is a list of all events that occur in Access 2002, and should give you an idea of how much you can achieve. Events new to Access 2002 are shown in bold.
Event | Belongs to... | Occurs... | Can be used for (for example)... |
---|---|---|---|
Activate | Forms; reports | when a form or report becomes the active window and gets focus | triggering the display of custom toolbars |
AfterBeginTransaction | Access Project Forms | after beginning to process a batch update | to determine that a batch update transaction has begun processing |
AfterCommitTransaction | Access Project Forms | after completing a batch update process | to determine that a batch update transaction has completed processing after it has been committed |
AfterDelConfirm | Forms | after the user has confirmed deletion of records or after theBeforeDelConfirm event is canceled. | determining how the user reacted to confirmation of the deletion of records. |
AfterFinalRender | Forms containing aPivotChart | after aPivotChart view has been fully rendered | to determine when aPivotChart view has finished rendering |
AfterInsert | Forms | after the new record has been added | requerying a form's recordset to show uptodate data |
AfterLayout | Forms containing aPivotChart | after all the charts in aPivotChart view have been laid out | to determine when allPivotChart s have been laid out prior to being rendered |
AfterRender | Forms containing aPivotChart | after aChartObject has been rendered for a form | running supporting procedures after the chart has been fully rendered |
AfterUpdate | Forms; controls on a form | after the changed data in a control or record has been saved | requerying a form's recordset to show up-to- date data |
ApplyFilter | Forms | after the user has chosen to apply or remove a filter, but before the filter is applied | changing the appearance of the form, depending on the filter criteria selected |
BeforeBeginTransaction | Access Project Forms | before a transaction is started on a Workspace | |
BeforeCommitTransaction | Access Project Forms | after a transaction is started and before it is committed | |
BeforeDelConfirm | Forms | after the user has deleted records, but before Access 2002 has asked for confirmation | creating your own messages asking the user for confirmation of records |
BeforeInsert | Forms | after the user types the first character in a record, but before the record is actually created | updating hidden ID fields in a related subform |
BeforeQuery | Forms containing aPivotTable | before querying or re-querying aPivotTable | when fields are added, removed or the pivot query is changed in any way |
BeforeRender | Forms containing aPivotChart | before any object in aPivotChart view has been rendered | check if aPivotChart is to be rendered or |
BeforeScreenTip | Forms containing Office Web Components | before a ScreenTip is to be displayed for an element in aPivotChart view orPivotTable view | check if a ScreenTip is to be displayed |
BeforeUpdate | Forms; controls on a form | before the changed data in a control or record is saved | validating data before it is saved |
BeginBatchEdit | Access Project Forms | after the first change to data --occurs after the form is activated, and after the last batch transaction is committed | determining when an edit begins on a form that is supporting batch edits |
Change | Controls on a form | after the contents of a control change (for example, by typing a character) | triggering the update of related controls on the form |
Click | Forms; controls and sections on a form | when the user clicks the mouse button over a form or control; when the user takes some action which results in the same effect as clicking would (for example pressing the spacebar to check a checkbox) | just about anything - this is one of the most used of all events and is about the only event used with command buttons |
Close | Forms; reports | after a form or report has been closed and removed from the screen. | triggering the opening of the next form. |
CommandBeforeExecute | Forms containing Office Web Components | before executing a PivotTable orPivotChart command | determine when a command execution is to begin or prevent the command execution using the Cancel event argument |
CommandChecked | Forms containing Office Web Components | just before the Checked property for aPivotTable orPivotChart command gets changed | respond to or modify the state of the Checked property for aPivotTable orPivotChart command in its menu |
CommandEnabled | Forms containing Office Web Components | just before the Enabled property for aPivotTable orPivotChart command gets changed | respond to or modify the state of the Enabled property for aPivotTable orPivotChart command in its menu |
CommandExecute | Forms containing Office Web Components | after executing a PivotTable orPivotChart command | call supporting procedures after aPivotTable orPivotChart have been executed |
Current | Forms | when the form is opened or requeried; after the focus moves to a different record, but before the new record is displayed | implementing intelligent navigation buttons (see example below) |
DataChange | Forms containing aPivotTable | after properties are changed and methods are called that modify values for aPivotTable | discover what values changed in aPivotTable and why |
DataSetChange | Forms | when aPivotTable is bound to a dataset or when the dataset changes | notify the user when data first becomes available or when a dataset is filtered |
DblClick | Forms; controls and sections on a form | when the user depresses and releases the left mouse button twice over the same object | implementing drilldown functionality in EIS applications |
Deactivate | Forms; reports | when a form or report loses focus to another window within Access | triggering the concealment of custom toolbars |
Delete | Forms | when the user attempts to delete a record | preventing the user from deleting records |
Dirty | Form; Combo box; Tab control | when the contents of a form, the text of a combo box changes, or when the page changes on a tab control | to identify when the details on a form have changed, so that they can be saved before closing the form |
Enter | Controls on a form | before the control receives focus from another control on the same form | similar to GotFocus |
Error | Forms; reports | when a run-time database engine error occurs (but not a Visual Basic error) | intercepting errors and displaying your own custom error messages |
Exit | Controls on a form | before the another form | similar to LostFocus |
Filter | Forms | after the user clicks the Advanced Filter/Sort or Filter By Form buttons. | entering default filter criteria for the user, or even displaying your own custom filter window. |
Format | Report sections | after Access 2000 determines which data belongs in each section of a report, but before the section is formatted for printing | displaying information on a report which is dependent on the value of other data on that report |
GotFocus | Forms; controls on a form | after a form or control has received the focus. | highlighting areas of the form which you wish to draw to the attention of the user when editing that control |
Initialize | Class | when a new instance of a class is created | set default properties |
ItemAdded | Reference | when a reference is added to the project from Visual Basic | to add extra references where dependencies occur |
ItemRemoved | Reference | when a reference is removed from the project with Visual Basic | to clean up anything done when the reference was added |
KeyDown | Forms; controls on a form | when the user presses a key over a form or control which has the focus | writing keyboard handlers for applications which need to respond to users pressing and releasing keys |
KeyPress | Forms; controls on a form | when the user presses and releases a key or key combination | testing the validity of keystrokes as they are entered into a control |
KeyUp | Forms; controls on a form | when the user releases a key over a form or control which has the focus | see KeyDown |
Load | Forms | after a form has been opened and the records displayed | specifying default values for controls on a form |
LostFocus | Forms; controls on a form | after a form or control has lost the focus | validating data entered into a control |
MouseDown | Forms; controls and sections on a form | when the user presses a mouse button | triggering the display of custom pop-up shortcut menus |
MouseMove | Forms; controls and sections on a form | when the mouse pointer moves over objects | displaying X and Y coordinates of the mouse pointer |
MouseUp | Forms; controls and sections on a form | when the user releases a mouse button | triggering the concealment of custom pop-up shortcut menus |
MouseWheel | Forms | when the mouse wheel is scrolled over a Form View, Datasheet View , PivotChart View , orPivotTable View | return the number of pages moved by using the mouse wheel |
NoData | Forms; reports | after a report with no data has been formatted, but before it is printed | suppressing the printing of reports which contain no data |
NotInList | Controls on a form | when the user attempts to add a new item to a combo box | creating a method for adding the item to the table which supplies values for the combo box |
OnConnect | Forms containing aPivotTable | when the specified PivotTable view connects to a data source | enable custom query functionality after connecting to the data source |
OnDisconnect | Forms containing aPivotTable | when the specifiedPivotTable view disconnects to a data source | display a message to let the user know that a data source isn't currently available |
Open | Forms; reports | when a form or report is opened but before the first record is displayed | setting focus on the form to a particular control |
Page | Reports | after a page has been formatted for printing, but before it is printing | drawing boxes, lines, and so on, on the page using various graphics methods |
PivotTableChange | Forms containing aPivotTable | when aPivotTable view field, field set, or total is added or deleted | enable controls to display a summary or total |
Report sections | after a section has been formatted for printing, but before it is actually printed | determining if a record is split across two pages | |
Query | Forms containing aPivotTable | when aPivotTable view is queried and the data is displayed | inform the user that the query has been completed |
RecordExit | Forms | before leaving or navigating off the current record | allow the user to cancel leaving the current record |
Resize | Forms | when a form is opened or resized | preventing the user from reducing the size of a form beyond certain limits |
Retreat | Report sections | during formatting when Access 2002 retreats to a previous section of a report | undoing actions you may have already instigated in the Format event handler |
RollbackTransaction | Access Project Forms | after a transaction has been rolled back when the BatchUpdates property is true | inform the user that proposed data changes have been cancelled |
SelectionChange | Forms containing Office Web Components | when a new selection is made in aPivotTable orPivotChart | enable or disable controls to begin a new query |
Terminate | Class (form, report or class module) | when the instance of the class is destroyed | to clean up any objects or resources that were used when the class was instantiated |
Timer | Forms | every time the period of time specified as the TimerInterval property has elapsed | causing controls to 'flash' |
Undo | ComboBox, TextBox | when a change is undone in a form, ListBox or ComboBox | reset variables used in a calculation based on the new selection |
UndoBatchEdit | Access Project Forms | when the Undo All Records command is used to cancel pending changes - occurs only when the BatchUpdates property is true | inform the user that a batch update has been cancelled |
Unload | Forms | after a form has been closed but before it is removed from the screen | displaying a message box asking the user for confirmation that the form should be closed |
Updated | Controls on a form | after an OLE objects data has been modified | determining if the data in a bound control needs to be saved |
ViewChange | Forms containing Office Web Components | when aPivotTable orPivotChart view changes and must be redrawn | refresh other related controls when aPivotTable is refreshed |