Add data macros in a desktop database

Access for Office 365 Access 2019 Access 2016 Access 2013

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

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

  1. Select Table and choose 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.

  1. Insert the macro actions.

  1. Save and exit 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, select Create Parameter.

  1. In the Name box, write a distinct name for the parameter.
  1. Optionally, input a description in the Description box as a tip to ascertain the purpose of the parameter.

Edit data macros

Use the Ribbon commands to make or update data macros.

Edit a data macro

  1. Access the table with the data macro that you want to edit.
  1. Pick the Table tab > choose 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.

  1. Access launches the Macro Builder, and you can begin editing it.

Rename or delete a macro

  1. Access the table with the data macro that you want to rename or delete.
  1. Press Table tab > Named Macro > Rename/Delete Macro.

  1. In the Data Macro Manager dialogue box, select Rename or Delete beside the data macro that you want to modify.
  1. To rename, state the new name and press ENTER on your keyboard.

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


Leave a Reply

%d bloggers like this: