What are Macros?
For those who do not know, a “Macro” is a tool that allows you to automate tasks that you do repeatedly. For example, deleting a record, or the automatic insertion of a field when a certain text is entered in another field. In this part of the course, we explain the basics of “Macros” but, for those of you who want to specialize, try searching on “Google” where such courses are offered.
Those who have worked with the earlier versions of “Access”, will no doubt have noticed that the “Macro”Builder window is completely renewed.
In 2007 version, the conditions were entered in the “Condition” (1) column, the actions in the “Action” (2) column and the arguments in the “Action Arguments” (3) panel.
In “Access” 2010, we have a totally different “Macro Builder” window. Everything is entered in the same window and the conditional instructions appear as traditional IF statements. To add actions to a “Macro”, you can select an action from the list box that appears when you click the downward pointing arrow (A), or you can choose from the “Action catalog” (B).
In this example, I will create a “Macro” that opens the “Teachers” form and select a state field in this form.
To create a “Macro”, select the “Create” tab in the “Ribbon” and click the “Macro” button.
When we click the “Macro” button, it opens the “Macro” window.
On the right side is the “Action Catalog” where, we find a list of available “Macros”.
You can navigate through, but it’s easier when you type in a keyword in the search box.
In this case I want to open an object, so I type “open” in the search box and immediately gives me the “Macros” available in “Access”.
To add a “Macro” from the list, click and drag it from the list in the “Macro” window or double-click it in the list. As always, I choose the easiest solution and double-click the “Open Form” in the list.
In the “Form Name” box, I choose the form that this “macro” should open , clicking the downward pointing arrow button.
The second “View” box is filled in correctly, so here we do not need to change anything.
The third “Filter Name” box and the fourth “WHERE Condition” box are not needed in this example, so leave them blank.
In the fifth “Data Mode” box, we determine the mode of the form. In this case, it is to add a record so, I choose “Add” from the drop-down list.
The last “Window Mode” box should remain as it is, in the default mode.
When everything is completed, click the “Run” button in the “Ribbon”.
“Access” will suggest that you first need to save the “Macro” before you can run this.
Click the “Yes” button, give a name to the “Macro” and click the OK button.
This opens the form with a new blank record.
As you will see, the “Macro” is added to the “Macros” object type.
Currently, the selected field is the first field in the new record, namely “PersonelID” but, in the next lesson we’ll see how to change the selected field to the “Name” field in the new record.
You've completed Lesson 66 START NEXT LESSON