MS-Access / Getting Started

Standalone vs. Embedded Macros

In previous versions of Access, all macros were individual database objects that could be used in event properties. Now with Access 2007, you can embed the macro directly in the event property without adding the macro to the object list in the Navigation Pane. If you do not expect more than one form or report control to need the macro, simply create it from the Property Sheet. If other form or report controls may be able to use the macro, save it as a standalone macro.

Standalone macros are individual Access objects listed in the Macros group in the Navigation Pane. Once you create and save a macro, it's available for attaching to an event property of any object in your database. Not all macro actions are appropriate for all objects, however, just as not all events occur on all objects. For example, if you create a macro that opens a form, you would probably attach it to the On Click event property of a command button or an option group, but not to a control in a report.

The process of using macros to automate an application is a simple one, composed of these steps:

  1. Open the form or report to which the macro applies in Design or Layout view and select the specific control.
  2. Open the Property Sheet for the control and click the Event tab.
  3. Click the desired event property and do one of the following:
    • Choose the macro name from the drop-down list.
    • Click the Build (...) button and use the Macro Builder to create the embedded macro.
  4. Save the form or report and switch to Form or Report view to try it.
[Contents] [Next]