Chapter 15. Using Access Data Macros

IN THIS CHAPTER

  • Creating data macros

  • Understanding table events

  • Building macros

  • Understanding macro limitations

A major new feature in Access 2010 is the ability to add data macros to your native Access tables. A data macro is logic you attach to a table to enforce business rules at the table level. In some ways a data macro is similar to a validation rule, except that a validation rule is rather unintelligent. All a validation rule can do is display a message to the user. Validation rules can't modify data or determine whether corrective action is needed. Data macros are specifically provided to allow you to manage data-oriented activity at the table level.

Most often, data macros are used to enforce business rules — such as a value can't be less than some threshold — or to perform data transformation during data entry. The real value of data macros is that they're in effect wherever the table's data is used. For example, if a data macro is attached to the sales table, any time the sales data is displayed on a form or report, the data macro is at work, watching for changes to the data and automatically controlling what happens to the table's data.

Note

This chapter uses a database named Chapter15.accdb. If you haven't already copied it onto your machine from the CD, you'll need to do so now. This database contains the tables, forms, reports, and macros used in this chapter.

Introducing Data Macros

Beginning with Access 2007, macros have played a more ...

Get Access® 2010 Bible now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.