New Features for Macros in Access

Okay, time to discuss those new features in macros that have been mentioned! Mind you, this is still a book about VBA, but these features are worth pointing out. Three features in particular—error handling, embedded macros, and TempVars—can certainly make using macros more attractive and even feasible in scenarios that were not possible in the past.

Error Handling

Error handling is often the primary reason that developers shy away from Access macros. In previous versions of Access, error handling in macros was simply not possible. When a macro encountered an error, there was no way to redirect the error to an error handler.

Macros in Access 2007 include error handling using the OnError, SingleStep, and ClearMacroError macro actions, and the MacroError object. The OnError statement defines the error-handling behavior for a macro action and includes two action arguments described in the following table:

Was this article helpful?

0 0

Post a comment