Getting to Know Microsoft Access, Part 9: Macros
(Page 1 of 4 )
This week we'll discuss, for those of you unfamiliar with programming, one of the more conceptually complex aspects of Microsoft Access. We'll start with a discussion of events: what they are and how Access uses them. Then, we'll move on to a lengthy discussion of macros, including what they do and how you design and use them.
The Event Model
In Access, an event is something that happens to an object, which in turn triggers a response of some sort. Usually events are caused by the user but can also be triggered by the program. For example, when Access loads you could make a form open automatically. This can happen because a form opening is an event.
Events are organized into eight different groups, each corresponding to a different type of effect. For example, some events work on data, others on keyboard actions, and so forth. Each event corresponds to a property of an object. For example, several controls have the "On Change" event property set. The eight different types of groups are: data events, focus events, error/timer events, keyboard events, filter events, mouse events, print events, and window events.
You can set event properties by opening the property sheet for an object and clicking into the Event tab. There you can specify what events you want to apply to the object. The following list shows the options available to you:
- You can set the event property to a macro group.
- You can set the event property to an existing macro.
- You can set the event property to an existing VBA procedure.
- You can set the event property to an existing user-defined function [enter an = sign followed by the function name and then empty parentheses () to so ]
- Click Build… to create a new macro, VBA procedure (using the Code Builder), or function (using the Expression Builder).
Next: Macros >>
More Microsoft Access Articles
More By Sage Adams