Chapter 36: Using Access Data Macros


Creating data macros

Understanding table events

Building data macros

Understanding data macro limitations

Beginning with Access 2007, macros have played a more significant role in many Access applications. For a very long time, macros were considered the poor cousins of VBA statements. Although in many ways VBA and macros were equivalent in their capabilities, macros have always been considered inferior to VBA for handling an application's logic.

The problems with traditional Access macros were considerable:

Macros existed as separate database objects, so keeping track of the macros in effect on a particular form was often difficult. Because there was no direct connection between a form (or a report, for that matter) and a macro, it was easy to break the macro by deleting or renaming it. VBA code encapsulated within the form's code module never had this problem.

There was no way to trap or handle errors in macros. In versions of Access prior to 2007, macros would simply stop running and display an error dialog box if something unexpected happened. These interruptions were not welcomed by users, particularly because there was, most often, nothing a user could do to correct the problem or prevent it from happening again. VBA code has always featured strong error handling and could often provide a default value or instruct the user what to do in the event of a problem.

Macros were unable to work with code. There was no way ...

Get Access 2013 Bible now with O’Reilly online learning.

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