Add data macros in a desktop database

You can use data macros to tables to do tasks like add, update or delete data or validate the accuracy of data. Data macros can be programmed to run immediately before or after you add, update or delete data in a table.

  1. In the Navigation Pane, double-click the table to which you want to add the data macro.

  2. Click Table and click the event where you want to add the macro. For example, for a data macro that runs after you delete a record from the table, click After Delete.

  3. Add the macro actions.

  4. Save and close the macro.

About parameters

Parameters are used in expressions to pass values and object references into a named data macro.

  1. At the top of the macro, click Create Parameter.

  2. In the Name box, type a unique name for the parameter.

  3. Optionally, add a description in the Description box as a tip to identify the purpose of the parameter.

Edit data macros

Use the Ribbon commands to create or modify data macros.

Edit a data macro

  1. Open the table with the data macro that you want to edit.

  2. Click the Table tab > click the event for the macro that you want to edit.

    Note: If an event does not have a macro associated with it, its icon is not highlighted on the menu.

  3. Access opens the Macro Builder, and you can begin editing it.

Rename or delete a macro

  1. Open the table with the data macro that you want to rename or delete.

  2. Click Table tab > Named Macro > Rename/Delete Macro.

  3. In the Data Macro Manager dialog box, click Rename or Delete next to the data macro that you want to modify.

  4. To rename, enter the new name and press ENTER on your keyboard.

For more, see creating a macro that runs when you open a database.

Share Facebook Facebook Twitter Twitter Email Email

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!

×