Sharing Data Macro Logic
The new Logic Designer in Access 2010 includes a very useful feature for sharing and reusing data macro logic. To illustrate this feature, open the tblTerminations table in Datasheet view in the Back Office Software System data copy sample web database (BOSSDataCopy.accdb). Next, click the Table contextual ribbon tab under Table Tools, and then click the After Insert button in the After Events group to open the Logic Designer. You've already explored the data macro logic attached to this table event earlier in this tutorial. Press Ctrl+A to highlight all the logic on the macro design surface and then press Ctrl+C to copy all the logic to the Windows Clipboard. Now, open Notepad or a different text editor and then press Ctrl+V to paste all the logic into Notepad.
Access copied the data macro logic from the Logic Designer as XML. You can send this XML to someone else, and that person can copy and paste the XML directly into a Logic Designer window for a data macro in his or her Access 2010 database. This feature can be especially useful if you are trying to help someone else write or debug data macro logic, such as in an Access forum or newsgroup. You can create the logic for the person you're helping and explain how you structured the program flow constructs, data blocks, and data actions.
You now have all the information that you need to modify and maintain your database table definitions.
In this tutorial:
- Creating Table Data Macros
- Uses of Data Macros
- The Data Macro Design Facility
- Access New Logic Designer
- Working with Before Events
- Grouping Macros
- Using If Blocks to Create Conditional Expressions
- Raising Errors in Data Macros to Cancel Events
- Testing Your Data Macro
- Defining Multiple Actions
- Collapsing and Expanding Actions
- Moving Actions
- Preventing Duplicate Records Across Multiple Fields
- Before Delete
- Working with After Events
- After Update
- After Delete
- Working with Named Data Macros
- Saving Named Data Macros
- Calling Named Data Macros
- Renaming and Deleting Named Data Macros
- Analyzing Errors in the USysApplicationLog Table
- Using Parameters
- Using Local Variables
- Working with Return Variables
- Debugging Data Macros
- Understanding Recursion in Data Macros
- Sharing Data Macro Logic