Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
An After Update data macro allows you to perform an action upon adding, updating or deleting a record. In our database, when a customer's order is marked Complete, it will be nice to send them an e-mail letting them know that their olive oil has been shipped. We can build this action right into our Orders table. To do this, open up your Orders table, and up on the Ribbon under Table tools, click on the Table tab, click on the After Update button. A Macro window will appear. In the first box, pull it down and choose If, and our criterion is going to be [OrderStatus.] And notice, as soon as I start typing, it auto fills with my possible matches.
I will pick OrderStatus off of my list. Put in an equals sign, a quotation mark, and then the word Complete. The square brackets around OrderStatus tell Access to look in that field, the equals sign tells it what to look for, and the Complete goes in quotes to show that it's a text value. Now, we will add an action. So If [OrderStatus] = "Complete ", we want it to send an e-mail. A box opens with e-mail parameters. In the To box type-in the square-bracket, the word Customers and the square bracket, an exclamation point, a square-bracket, and the word Email.
This tells it to look in the Customers table for a field called Email and enter it into the To field. I will Tab down to the Subject line and I'll type Your Two Trees Olive Oil has been shipped. In the body line I'll type-in Your order has been shipped. Please let us know when it arrives and how you like it. Click the Save button in the Ribbon and then close the macro. Now, let's test this out. Scroll down to the bottom of the order form and here's an order that's been backordered.
Let's change this to Complete. When we click off the Record, I get a message from Outlook saying that a program is trying to send an e- mail message on our behalf. I will click Allow. Data Macros are a great way of automating tasks based on adding, changing, or deleting your records.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 73876 Viewers
80 Video lessons · 129416 Viewers
52 Video lessons · 63754 Viewers
59 Video lessons · 49524 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.