Access Power Features   «Prev 
Assigning macros to controlson a form

Getting help on events

To find out what events you can use for the various objects:
  1. Pick Microsoft Access Help from the Help menu.
  2. While in the Index tab, type Event in the "1. Type keywords" field, then press Enter.
  3. Choose a topic field from the "3. Choose a topic field", and then press Enter.
You will then see something similar to this figure, which lists the various events and the objects they apply to.
MS Access Help dialog box
MS Access Help dialog box

Table Events
You can use three types of table events in web apps, each attached to an event on the table. They are
  1. After Insert,
  2. After Update, and
  3. After Delete
As the names for each event imply, they fire when you add a new record, modify an existing record, or delete a record, respectively. If you want the same data macro to be executed from more than one table event, consider using a standalone data macro and calling it in each table event.
Note: Though the table events are labeled “After”, you still can cancel such events by raising an error within the table event which will then prevent the action, be it inserting, updating or deleting, from completing. Generally speaking, a data macro is usually executed when a UI macro invokes the data macro via a RunDataMacro macro action or via one of the table events.
Context in Data Processing
In a standalone data macro, it is necessary to first establish the context in order to perform data modifications. What this means is that you must specify the table on which the data macro will make changes.
On table events, the context is usually already established and you can have your macro act directly on the current record. In the case of an update or delete event, you also have access to the old virtual table, which contains the original data from the affected row of the table.