Access 2010 New Feature: Data Macros
One of the newest features in Access 2010 that I am excited about is the ability to create Data Macros. In previous versions of Access, if you wanted to automatically update data in a table you’d have to attach or embed a macro to a form that would then update data inside a table. Now, with Data Macros, you can attach logic directly to table and record events, a feature quite similar to SQL triggers.
Data macros are portable, secure and scalable for a server/service environment. Data macros can even survive the trip to the web if you choose to convert your database to a web database.
Data Macros can be used for a variety of purposes. Everything from tracking when a record was last modified (something that I demonstrate how to do in my new Access 2010 Training course) or deleted to preventing blank values if a certain condition is not met.
Today we’ll take a look at the steps it takes to create data macros in Access 2010 and I’ll also show you how to paste macros into a text editor as XML.
1. Open a table to Design View and in the Table Tools Design Tab, in the Field, Record & Table Events Group, click on the button “Create Data Macros.”
2. Click on a Table Event to launch your Macro Builder.
3. Next, write your macro and save.
Note: Data macros cannot process multi-valued or attachment data-types.
Did You Know?
You can also paste macros into a text editor as XML, making it easy to edit or even share macros with others.
1. Simply open and select your macro (if selected, a gray box will appear around the actions).
2. Right-click and choose Copy.
3. Open a text editor like Notepad and paste.