The mcrEmployees macro with two additional actions.
A message boxthe result of the MsgBox action.
Macros can contain as many actions as necessary to automate even the most complicated tasks. Each action appears in its own row and is evaluated and executed in the order in which it appears in the Macro window, from top to bottom.
In this lesson you will edit the macro you created in the previous lesson to change its arguments and add some more steps or actions.
Select the mcrEmployees macro and click the Design button.
The mcrEmployees macro opens in Design view. Let's add two more actions to this macro.
Click the Action cell just below the OpenForm action, click the list arrow, scroll down the list, and select Maximize.
When you run the macro, the Maximize action will maximize the window so that it fills the entire Microsoft Access window. Because the Maximize action is so simple and straightforward, it doesn't have any additional arguments.
Let's add another action to the mcrEmployees macro.
Click the Action cell just below the Maximize action, click the list arrow, scroll down, and select MsgBox.
When you run the macro, the MsgBox action will display a message box that contains a warning or an informational message. The Message argument is the most important argument for the MsgBox action because it determines the text that is displayed in the message box.
Click the Message argument box and type
Please make sure that you remember to add the
employee's phone number!.
There are several other arguments you may want to specify for the MsgBox action, such as the type of icon that is displayed in the message box (None, Critical, Warning?, Warning!, or Information) and the text that is displayed in the title bar of the message box.
Click the Type argument box, click the list arrow, and select Information. Click the Title argument box and type
Your macro should look like the one shown in figure. Remember that actions are evaluated and/or executed in the order in which they appear, so the mcrEmployees macro will (1) open the frmEmployees form, (2) maximize the form window, and (3) display the message box.
Click the Save button on the toolbar.
That's all the we need to do for this lesson.
Close the macro window.
Let's test the macro.
Double-click the mcrEmployees macro.
Sure enough, the mcrEmployees macro (1) opens the frmEmployees form, (2) maximizes the form window, and (3) displays the message box, as shown in figure.
Click OK to close the message box, then click the Close button to close the frmEmployees form.
To modify a macro:
in the database window, click the macros icon in the objects bar, select the macro you want to edit, and click the design button.updated