How to Use Macros in Data in Microsoft Access

Microsoft Access is database application software that lets you create database of various sorts with ease. The best part about Microsoft access database is that it helps one to quickly track and report information. It provides the user with rich user interface and interactive design capabilities. It can also be used for web applications. Data macros in Access enable you to add logic to events that occur in tables such as adding, updating, or deleting data.


Step # 1 – Using after update

In order to create a data macro, first open up the orders table. Over there, go up to the “tables” tab and then click on the “After update” button; a macro window will open as a result.

Making use of after update

Step # 2 – Adding task

In the first box, write down “if” and then start typing “order status” in a square bracket.
You will get a drop down with the possible matches present in the database. Double click on order status and it puts it in the bracket. Insert the “equals to” sign and after that, in quotation marks type “complete”.

Including task

Step # 3 – Fill in the information

In the next box, select send email and a box of email options will open. In the “to” field, type “customers” in square brackets then add an exclamation mark and type “email address” in another square bracket to complete the expression. Now complete the form by typing in data in the subject and body field.

Entering data

Step # 4 – Triggering macro

Now go to your orders table and type in details for a new order. Select a customer from the drop down, choose a product and lastly type in the quantity. Leave the order status field on processed and move over to the next field.
Now go back to the “order status” field and change it to “complete” and an email would be sent to the customer automatically.

Turning on the macro

You can use data macros in Access to validate and ensure the accuracy of data in a table. There are two main types of data macros—those that are triggered by table events (also called “event-driven” data macros), and those that run in response to being called by name (also known as “named” data macros). One more thing about Microsoft access database it that it can be managed in an effective manner using macros.