Part IV: Professional Database Development
1058
The macro action drop-down list contains Submacro as an entry. While working on a macro,
selecting Submacro from the action list adds an area to the macro where you can input the actions
associated with the submacro.
Without using submacros, you’d have to create three separate macros to automate a main menu
form with three buttons that open frmContacts, frmProducts, and frmSales. Using sub-
macros, just create a single top-level macro that contains three submacros. Each of the submacros
opens one form. Only the top-level macro appears in the Navigation Pane. Table 30.2 shows the
submacro names, the actions, and submacro actions for mcrMainMenu.
TABLE 30.2
mcrMainMenu
Submacro Action Action Argument Action Argument Setting
OpenContacts OpenForm Form Name frmContacts
View Form
Filter Name <Leave Blank>
Where Condition <Leave Blank>
Data Mode <Leave Blank>
Window Mode Normal
OpenProducts OpenForm Form Name frmProducts
View Form
Filter Name <Leave Blank>
Where Condition [ProductID]=3
Data Mode Read Only
Window Mode Dialog
OpenSales OpenForm Form Name frmSales
View Layout
Filter Name qrySales2008
Where Condition <Leave Blank>
Data Mode Edit
Window Mode Icon
Figure 30.7 illustrates the submacro concept. A new macro is under construction. The developer
has selected Submacro from the Add New Action list, provided a name (OpenContacts) for
the submacro, and filled in its properties.