Applies ToAccess for Microsoft 365 Access 2024 Access 2021 Access 2019 Access 2016

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.

  1. 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.

Add event driven data macro

Access opens the Macro Builder. If a macro was previously created for this event, Access displays the existing macro.

  1. Add the actions that you want the macro to perform.

  2. 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.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.