How to Create a Macro Group in Access

by rhyttinen on December 10, 2010

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Today, we continue our discussion of Access macros and take a look at macro groups. If you find yourself creating a large number of macros, creating macro groups can help you manage your macros more easily. A macro group is a collection of related submacros all stored together in a single macro object. If you have used macro groups in previous versions of Access, you may be trying to figure out how to do the same in Access 2010 – as the process has completely changed (it personally took me awhile to figure it out!).

In the illustration below, the macro group, named mcrOpenForms, is made up of three related macros: OpenRegistration, OpenStudents and OpenClasses. The name next to the word Submacro identifies each separate group of macro actions and specifies the beginning of the macro. When the group is expanded, the words End Group mark the end of the macro in that group. These three macros were included in this group because each macro carries out the OpenForm action.

A macro group in Microsoft Access

You can run a macro in a macro group in an event by typing the macro group name followed by a period and then the macro name. In the preceding example, to refer to the OpenStudents macro in the mcrOpenForms macro group, you would type:

mcrOpenForms.OpenStudents

Note that the Submacro action is different than the Group action. Group actions cannot be called or executed – they mainly serve to increase readability by storing program flow in named, collapsible blocks.

To Create a Macro Group

  1. Create a blank new Macro.
  2. Click the Add New Action drop-down arrow and choose Submacro from the list.
    Or
    Expand the Program Flow category in the Action Catalog window and double-click Submacro.
  3. Click in the Submacro box and type in a name for the group. This is how you identify each individual macro.
  4. Add the actions to the group you want the macro to carry out.
  5. To add another macro, click anywhere outside of the group and repeat steps 2-4.
  6. When finished, click the Save button and provide a descriptive name for the Macro Group.

Note: You cannot run a macro group (a macro containing submacros) directly from the macro window. Submacros can only be called by a RunMacro or OnError macro action.

Similar Posts:

Share and Enjoy:
  • del.icio.us
  • Digg
  • TwitThis
  • Reddit
  • Technorati
  • Facebook
  • StumbleUpon
  • Google Bookmarks
  • Propeller
  • email

Comments on this entry are closed.

Previous post:

Next post: