Creating Macros

Creating  Macros
 
Macro is instruction set which can be either run automatically or can execute/run when a user presses a special key or it can run automatically every-time when your database is open i.e. mostly you have to enter the data into the database. You can create a macro that whenever your database is open, form is displayed so that you can start entering data directly into the system.
 

Macro Builder Feature

In order to create a macro by using the Macro Builder feature , go to the Create ribbon and on the Other group, click on Macro.
 
 
From the drop down list, choose Macro. This will display the Macro Builder. When you first open the Macro Builder, notice that the Action, Arguments and Comment columns are displayed. The Macro Builder can be used to create stand-alone macros.
In order to create a macro –add actions to the macro -, choose an action from the drop down list, enter the arguments and write a short comment if needed.
 
 
 
 

Macro groups

If you want a macro object to execute several related macros, you can create a macro group.
In order to create a macro group, click the Create ribbon and on the Other group, click the arrow near Macro and choose Macro (see figure 1 ). Go to the Design tab and in the Show/Hide group, click on Macro Names to display the Macro Name column.
 

 
Macro names have to be used when creating macro groups to distinguish individual macros from each other. A macro in a macro group ends when the next macro name is encountered.
Type the name of the first macro in the Macro Name column and the actions you need the first macro to carry out. When you are done with the first macro, move to the next empty line and type the name of the next macro. Then add the actions and so on until you have add all the needed macros and actions.
 
 

Embedded Macros

The embedded macros are not displayed as macros in the Navigation Pane but they are stored in the event properties of controls, reports or forms. It can make the database more manageable because you do not have to keep track of endless macros. Embedded macros also have the advantages that are copied with the form, control or reports when they are copied, imported or exported.
In the Navigation Pane, right-click the form or report that will contain a macro and then click on Design View.
 

 
Click the Property Sheet and then click the control or section that contains the event in which you want to embed the macro. Click the dots and choose Macro Builder and then click OK.
 

In the Macro Builder click the drop-down Action list and choose the action that you want. Add as many actions as needed and then Save the Macro.
 
 
The macro will run each time the event property is triggered. Pay attention that in a macro group only the first macro runs.

No comments:

Post a Comment