Quiz 10: Automating Tasks With Macros


• A macro contains set of instructions or actions which execute a task, usually macros are written in order to automate certain tasks performed by Access, Instead of writing or repeating code for certain tasks which are frequently performed by Access, a macro is created with set of instructions, and this macro is called or used whenever required. • Most commonly a macros can be used to open a form, close a form, to display a message box giving a message or warning to the user, to exit from Access, these are certain frequently performed actions by a Access user, instead of writing the code whenever required, a macro is written with these set of actions and that macro is called at that particular place. More similar to a predefined function used in C or C++.

A Macro Designer is a Design window provided by Access, this window provides the users with tools for designing a macro, in the Macro designer a user can create a new macro, can make changes in already existing macros. Components in the Macro Designer: • Run button: used to run the currently open Macro code. • Single Step: when we press the single step button each action in the macro is executed at a time, after executing a single action a pause occurs. • Convert Macro To Visual Basic: this button is used to create a VB version of the macro created. • Action Catalog: By pressing this button we can view all the list of actions, list of macros which already exist in the database. • Show All Actions: To view and close all the actions present in the Access database. • Collapse and Expand buttons: to collapse and expand the actions currently used in the macro.

A MessageBox Action is used to create user interface components, using a message box action in a macro creates a dialog box, through which we can display a message to the user. Until the user presses the 'OK' button present on the dialog box, the dialog box does not disappear, and the next action is not executed.