Microsoft Office Tutorials and References
In Depth Information
Setting Up Your Own Main-Menu Form
3. In the Save As dialog box, type a name for the form, and click OK.
Call the form something like Main Menu. Leave the form open; you
make buttons for it later.
Now you’re ready to make the AutoExec macro that opens the form
4. Create a new macro.
A blank macro appears.
5. Add an OpenForm action to the macro.
6. Set the Form Name argument to the name of the form you just created
To do so, click the Form Name argument, click its down arrow, and
choose the form from the drop-down menu that appears.
7. Close the macro, click the Yes button to save it, and name it AutoExec.
You have to name your macro AutoExec if you want the macro to run
automatically each time you open the database.
8. Create another macro by clicking the Macro button in the Macros &
Code group on the Create tab of the Ribbon.
Your main-menu form needs a macro to contain the submacros your
buttons will run. You could make all your buttons by using the Command
Buttons Wizard, which stores its submacros as embedded macros, but if
you want to make your own submacros for your buttons, you can store
them in the macro you create here.
9. Click the Save button or press Ctrl+S to save the new macro.
10. Type a name for the macro, and click OK.
You don’t have to give the macro the same name as the main-menu
form — but you’ll find yourself less confused if you do! If you took our
advice in Step 3, name the macro Main Menu or Main Menu Form.
11. Click the tab for the Main Menu form so that you can start adding
Now you’re ready to return to your main-menu form (the one you created
back in Step 1 — remember?) and add command buttons.
The form is ready and appears when you open the database; all it needs is
Creating command buttons for your main-menu form
For each button you want to use on the main-menu form, create a command
button and (if necessary) a macro for it to run. When you create a command
button, the Command Button Wizard writes embedded macros to open