Create Menus with Macros - MS Access 2003.
We learned earlier how to create Menus and toolbars through the Toolbars -> Customize options. If you would like to have a second look at them, then the links are given below:
- Calendar and Toolbars - Access 2003
- Custom Menus and Toolbars - Access 2003
- Custom Menus and Toolbars-2 - Access 2003
- Inputbox and Simple Menus
There are other methods for creating simple custom menus for Forms/Reports in your Applications. This time, we create a Shortcut Menu with Macros and attach it to a Form.
Sample Demo Run.
Select the Macro Tab on the Objects pane.
Click New to open a new Macro in Design View.
If the Macro Name Column is not visible, click the Macro-Name Toolbar Button (the xyz label) that displays the name column.
Type 'Clo&se' under the Macro Name column in the first row.
Select Close from the drop-down list under Actions.
Type &Preview in the second row under Macro Name.
Under Action, select the OpenReport option from the drop-down list.
In the Property Sheet under Action Arguments, select a Report from your list of Reports (I selected the Employees Report in the sample image given above) in the Report Name Property.
Select Print Preview in the View Property.
Type &Form in the third row under the Macro Name column.
Select Open Form in the Action Column.
Select an existing Form's name from the Form Name Property drop-down list.
Select the Form in the View property.
Type a dash (-) character in the next row under the Macro Name column.
Type &GotoNext in the fifth row under the Macro Name column.
Select GotoRecord in the Action Column.
Type &Minimize in the sixth row under Macro Name.
Select Minimize from the drop-down list in the Action Column.
Save the Macro named mcrShortCut and close it.
You can add as many commands or actions, like opening Queries or running Programs, to your menu for the convenience of your Application Users.
Defining Macro as Menu.
Our work on the Macro Menu is complete, but a few more actions are left to define the Macro as a Menu.
Open a new macro in the design view.
Select AddMenu from the drop-down list in the Action Column.
Leave the Menu Name Property Blank. This is used for Group Menu Names when you have group Menus with different sets of actions. In this case, the Macro will have more than one AddMenu Action line with a different set of Menu Macros.
Select mcrShortCut in the Menu Macro Name Property.
Save the macro named mcrShortCutMenu.
Open one of your Forms in Design View (don't open the form that you have used in the OpenForm action in the first macro).
Display the Form's Property Sheet (View -> Properties).
Set the following Property Values of the Form as given below:
- Shortcut Menu = Yes
- Shortcut Menu Bar = mcrShortCutMenu
Save the Form.
Open the Form in a normal view.
Right-click on the Form to display the Shortcut Menu. See the sample image given below:
Try out the options displayed in the Shortcut Menu.
We can create Shortcut Menus, Toolbars, and Menu Bars too. This we will learn Next.




















