Microsoft Office Tutorials and References
In Depth Information
Introducing Macros
Introducing Macros
A macro is a list of actions that happen when you run the macro. (That
general definition works for almost any programming language, actually.) You
may have a macro that performs these actions when you click a button on
a form:
1. Saves the current record.
2. Prompts you to put a blank mailing label in the printer.
3. Prints a report, filtering the records to include only those that match the
record currently displayed on the form.
Most macros are short and sweet, like this example. For more complex
programs, you need VBA.
Macros can live as independent, stand-alone objects, or they can be
embedded in tables, forms, or reports, as follows:
Stand-alone macros are among the types of objects that Access displays
in the Navigation Pane. (If the Navigation Pane doesn’t appear in your
Access window, press F11 to expand it.) If you don’t have any
standalone macros, the Navigation Pane doesn’t display a section for macros,
even when you display objects by type (by right-clicking the Navigation
Pane and choosing Category Object Type from the contextual menu).
When you have at least one macro, the macros section appears.
Data macros are stored as part of a table. You can configure your table
to run macros before or after a record is added, edited, or deleted.
These macros are great for validating data or setting values
automatically. See Chapter 2 of this minibook for directions on setting them up.
Embedded macros are stored as part of a form or report. These macros
are run only when events are triggered by the form or report, or by
objects on the form or report. Chapter 2 of this minibook describes how
to create embedded macros that run when you use a form or report.
Creating and Editing Stand-Alone Macros
Creating a stand-alone macro (a macro that’s not embedded in a table, form,
or report) is easy. Follow these steps:
1. Click the Macro button in the Macros & Code group on the Create tab
of the Ribbon, opening the Macro Builder.
Access displays a tab with a new, blank macro, where you enter the
actions that make up the macro. Figure 1-1 shows a macro with one
action already entered. Macros in Access 2013 contain a list of actions
along with arguments (additional information) for each action.
Search JabSto ::

Custom Search