MS Access 2007 Step By Step - Asim Abbasi
CH1: Overview | CH2: MS Access Local & Linked Tables | CH3: MS Access Queries | CH4: MS Access Reports & Forms | CH5: MS Access Modules & Macros | CH6: MS Access Data Import/Export Feature | CH7: MS Access Built-In Functions
Chapter 5: MS Access Modules & Macros

Macros are used to automate tasks in MS Access. If there are 10 make
table queries that you have to run one after another in a step by step
where the output of one query depends on the output of the other query,
such kind of stuff and many similar type can be achieved using Macro
with just a single click or the occurrence of certain event.
We will look into details about macros and how to use them in MS Access,
in this section. Moreover we will complete our auto login ability
project too.
Creating Macro: AutoExec
1. To create a new macro click the “Create” command as shown in Figure
5-8 with label 1.
2. Expand the “Module” list on the ribbon as shown with label 2 in
Figure 5-8.
3. Click the “Macro” command on the expanded list as shown in Figure 5-8
with label 3.
4. After performing the first three steps you will be in macro design
view as shown in Figure 5-9. Under the action expand the drop-down list
to select the “RunCode” command as shown with label 5.
5. Select the AutoExec() function by expanding the doted button (…) as
shown in Figure 5-9 with label 4.

Figure 5-8: Getting into Macro Design View.
________________________________________

Figure 5-9: Macro Design View.
________________________________________
Each line on this window you can specify the Macro commands under the Action field. All the Macro commands will appear as soon as you will click the drop down menu. From this list select the RunCode command option. This has been shown as label 5 in Figure 5-9. Then select the function that we created earlier in the module section of this chapter i.e. AutoExec() function.

Figure 5-10: Complete list of Macro actions under the drop-down list.
________________________________________
Chapter 5: MS Access Modules & Macros
CH1: Overview | CH2: MS Access Local & Linked Tables | CH3: MS Access Queries | CH4: MS Access Reports & Forms | CH5: MS Access Modules & Macros | CH6: MS Access Data Import/Export Feature | CH7: MS Access Built-In Functions
Share with others: