Access 2016 Advanced

Lesson 11 – Using Macros

Access 2016

E XERCISE

U SING M ACROS

Task

Use macros.

1. Open MACROS2X.ACCDB . 2. Rename the Open Payment/Invoice macro to Autoexec . Make sure that you press [Enter] after you rename it. Close the database and reopen it to test the macro. Notice that the two form windows open. Close the form windows. 3. The Balance macro opens a message box warning that there is a balance due for the project. Attach the Balance macro to the Balance Due text box control on the Payment Form form. Use the On Got Focus event. Close and save the form. 4. Open the Payment Form form in Form view. Click the Balance Due text box. Notice that a message box opens. Close the message box. Move through the next several records and notice that the message box opens whether or not there is a balance due. Close the form window. 5. Add a condition to the Balance macro so that the macro only runs when the balance due is greater than 0. Enter the following condition for the macro: Forms![Payment Form]![Balance Due]>0 . 6. Close the Macro Design window and save the changes to the macro. 7. Open the Payment Form form in Form view. Click the Balance Due text box. Notice that a message box opens for the first record because there is a balance due (a balance greater than 0). Move through the next several records and notice that the message box only opens when a balance is due. Close the form window. 8. Create a group macro. Enter the following names, actions, and arguments in the Macro Design window:

Macro Name

Action

Argument

Form Name: Client Information Form

Open the form

OpenForm

Open the Trainer table OpenTable

Table Name: Trainer

9. Save the macro as Client Macros . Close the Macro Design window. 10. Close the database file.

Page 136

OFFICEPRO, Inc.

Made with FlippingBook - Online magazine maker