Part II: Programming Microsoft Access
576
Access 2010 data macros are not supported on linked tables. If the table in an Access database is
linked to SQL Server, you can’t write data macros for the table. You must use traditional user inter-
face macros or VBA code for this purpose.
Data macros can’t call VBA procedures. One of the primary objectives for data macros is to make
them portable to SharePoint when an Access application is upsized. Any calls to VBA procedures are
sure to fail because there is no way to convert VBA to JavaScript in the SharePoint environment.
Cross-Reference
Publishing an Access database to SharePoint is discussed in Chapters 34 and 35.
Data macros don’t support transactions. Every field and record update is executed immediately,
and there’s no way to roll back multiple table changes.
Finally, data macros are not compatible with earlier versions of Access. An Access 2007 application
(with Service Pack 1 installed) can read, but not write to, Access 2010 tables containing data mac-
ros. You could, if necessary, use Access 2010 data macros to maintain tables intended for back-
ward compatibility. These data macros would automatically update the “backward compatibility”
tables every time a change (insert, update, or delete) is made to a Access 2010 table. Access 2007
and earlier versions would either link to or import data from the backward-compatibility tables.
Summary
This chapter has taken a brief look at the Access 2010 data-macros feature. Access has never before
supported the capability of executing programmable logic in response to changes at the table level.
Server-based databases like SQL Server have long had triggers that perform these tasks in their
databases, and Access developers have waited a long time for similar capabilities in Access.
Access data macros support a rich set of program-flow, data-block, and macro-action items. When
properly applied to Access tables, data macros provide you with valuable options and features,
such as validating data, maintaining update logs, and calculating derived values — all at the table
level.
When properly used in Access 2010 applications, data macros are capable of reducing the amount
of VBA code required for managing data while adding considerable consistency to an application’s
data handling.