What is a Macro?
Macros are a set of actions that help you to automate common tasks. By using groups of macros, you can perform several tasks at once.
Conditional actions
These are used to determine whether in some cases an action will be carried out when a macro runs. For example, if you're using a macro to validate data in a form, you might want to display one message in response to one set of values entered in a record and another message in response to a different set of values. In cases like these, you can use conditions to control the flow of the macro.
A condition is a logical expression that evaluates to True/False or Yes/No. The macro follows different paths depending on whether the condition is true or false. When you run the macro, MS Access evaluates the first conditional expression. If the condition is true, Microsoft Access carries out the action in that row and any of the immediately following actions that are preceded by an ellipsis (...) in the Condition column.
If the condition is false, MS Access ignores the action and any immediately following actions that are preceded by an ellipsis in the Condition column and moves on to the next action row that contains another condition or a blank Condition column.
Action arguments
Action arguments are additional information required by some macro actions—such as the object affected by the action or special conditions under which the action is carried out. After you add an action to a macro, you set the arguments for the action in the lower portion of the Macro window. These arguments give MS Access additional information on how to carry out the action.
Having learned about Macros, Micheal now wants to print a record. To do this:
- Open the table, query, or form in Datasheet view, PivotTable view, or PivotChart view.
- Do one of the following:
- Print the entire datasheet, or print the data in PivotTable view or PivotChart view.
- Print only certain records in the datasheet. To do this
| To select | Click |
|---|---|
| Data in a field | Where you want to start selecting and drag across the data. |
| An entire field | The left edge of the field in a datasheet, where the pointer changes into. |
| Adjacent fields | The left edge of a field and drag to extend the selection. |
| A column | The field selector. |
| Adjacent columns | The field name at the top of the column and then drag to extend the selection. |
| A record | The record selector. |
| Multiple records | The record selector of the first record, and then drag to extend the selection. |
| All records | Select All Records on the Edit menu. |
On the File menu, click Print, and then click Selected Record(s).