D1 Session 6 Macros
Macros are used to automate your database A named sequence of instructions Each instruction is called an action Each action carries out a particular task –E.g. Open a form Each action has arguments that describe how to carry out the task –E.g. the name of the form to open What is a macro?
Directly (from database window or macro design view) –generally for testing Response to event –e.g. button click Automatically when open database –Autoexec Macro Running a macro
Store related macros together Each macro runs independently Use Macro Name column in macro design sheet Each macro has a qualified name –E.g. macFormButtons.Close –In macro object list will be listed as macFormButtons Macro Groups
The result of an action by the user –E.g. clicking a button, opening a form Events are associated with forms, reports and controls Use the objects Event Properties to assign a macro (or VBA procedure) to an event –E.g. to run a macro when a button is clicked assign the macro to the On Click Event property of the button What is an Event?
AutoExec Echo Beep Hourglass OpenForm macFormButtons Close RunCommand GotoRecord Macro Action Review