Chapter 30. Using Access Macros

IN THIS CHAPTER

  • Getting acquainted with macros

  • Working with multi-action macros

  • Using submacros for actions that are frequently required

  • Making decisions with conditions

  • Using temporary variables

  • Handling errors and debugging your macros

  • Understanding embedded macros

  • Comparing macros to VBA

Macros have been a part of Access since the beginning. As Access evolved as a development tool, the Visual Basic for Applications (VBA) programming language became the standard in automating Access database applications. Macros in previous versions of Access lacked variables and error handling, which caused many developers to abandon macros altogether. Access 2010 has these capabilities (added in Access 2007), which make macros a better alternative to VBA than in previous versions. If it's a slow day and you don't feel like writing VBA code, or if you aren't a VBA guru but you still want to customize the actions that your application executes, then building structured macros is the answer.

Note

This chapter uses a database named Chapter30.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.

An Introduction to Macros

A macro is a tool that allows you to automate tasks in Access. It's different from Word's Macro Recorder, which lets you record a series of actions and play them back later. (It's also different from Word in that Word macros are actually ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.