Create a macro or macro group

Microsoft Office Access 2003

  1. In the Database window, click Macros Button image under Objects.
  2. Click the New button on the Database window toolbar.
  3. Add an action to the macro.

    ShowHow?

    1. In the Macro window, click the first empty row in the Action column. If you want to insert an action between two action rows, click the selector for the action row just below the row where you want to insert the new action, and then click Insert Row Button image on the toolbar.
    2. In the Action column, click the arrow to display the action list.
    3. Click the action you want to use.
    4. In the lower part of the window, specify arguments for the action, if any are required. For action arguments whose settings are a database object name, you can set the argument by dragging the object from the Database window to the action's Object Name argument box.
    5. Type a comment for the action. Comments are optional.
  4. To add more actions to the macro, move to another action row and repeat step 3. Microsoft Access carries out the actions in the order you list them.

ShowCreate a macro group

If you want to group several related macros in one place rather than keeping track of them separately, you can organize them as a macro group.

  1. In the Database window, click Macros Button image under Objects.
  2. Click the New button on the Database window toolbar.
  3. Click Macro Names Button image on the toolbar, if it isn't already selected.
  4. In the Macro Name column, type a name for the first macro in the macro group.
  5. Add the actions you want the macro to carry out.

    ShowHow?

    1. In the Macro window, click the first empty row in the Action column. If you want to insert an action between two action rows, click the selector for the action row just below the row where you want to insert the new action, and then click Insert Row Button image on the toolbar.
    2. In the Action column, click the arrow to display the action list.
    3. Click the action you want to use.
    4. In the lower part of the window, specify arguments for the action, if any are required. For action arguments whose settings are a database object name, you can set the argument by dragging the object from the Database window to the action's Object Name argument box.
    5. Type a comment for the action. Comments are optional.
  6. Repeat steps 4 and 5 for any other macros you want to include in the macro group.

Notes

  • When you run a macro group, Microsoft Access executes each macro, starting from the first action, until it encounters a StopMacro action, another macro group name, or no further actions.

  • When you save the macro group, the name you specify is the name of the group of macros. This name is displayed in the list of macros and macro groups in the Database window. Whenever you refer to a macro in a macro group, use this syntax:

    macrogroupname.macroname

    For example, Buttons.Products refers to the Products macro in the Buttons macro group. In a list of macros, such as the Macro Name argument list for the RunMacro action, Microsoft Access displays the Products macro as Buttons.Products.