Suppose you want to have Access take an action either immediately before or after you add, update, or delete data in a table, you can do it by adding data macros to the table event. While working with macros can seem a bit daunting at first, here are basic steps to get you started. Also, take a look at other macros topics available at the end of this article.
Note: Use the following steps if you are working with a desktop database.
-
Open the table, on the Table tab, click the event to which you want to add the macro. For example, to create a data macro that runs after you delete a record from the table, click After Delete.
Note: When an event already has a macro associated with it, its icon appears highlighted.
Access opens the Macro Builder. If a macro was previously created for this event, Access displays the existing macro.
-
Add the actions that you want the macro to perform.
-
Save and close the macro.
While the Macro Builder can help you create or edit a macro, if you haven’t used macros get an overview to macros or more about working with data macros. You might also like to find out about creating user interface (UI) macros.