2.2. VBA versus Macros in Access

Now that you've seen a little about how VBA works within Access you might be chomping at the bit to get started. However, there's one other item you should consider before jumping into Access programming without looking back: a macro. A macro is simply a saved series of commands. Unlike in Word and Excel, where you can record your own macros, in Access you create the macro yourself, step by step. A macro enables you to perform a variety of operations in Access in response to the click of a command button or any other programmable event on a form or report.

Macros in Word or Excel refer to a piece of VBA code that you would write in a module in Access. In Access, a macro is a separate type of object, one that's made up of a list of actions. Note that Word and Excel also enable you to create your own modules.

If you've programmed in Word or Excel, you know that you can create a macro by starting the macro recorder and performing the desired steps. When you stop the macro recorder, all of the operations you've performed—from mouse clicks to keyboard strokes to menu selections—are recorded and saved in VBA code. You can then run the macro at a later time by selecting it from the Macros dialog box or in response to a keyboard or Ribbon command. After you've recorded your macro, you can examine the VBA code behind the macro by simply choosing Edit from the Macros dialog box. This is one of the easiest ways to learn some VBA code within Word or Excel. ...

Get Access™ 2007 VBA Programmer's Reference 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.