Microsoft Office Tutorials and References
In Depth Information
Chapter 1: What the Heck Is VBA?
You can also get to a class module from the Event tab of the property sheet
in the Design View window. The property sheet allows you to zoom right in
on the VBA code that’s associated with a given control. Some controls, for
example, contain code created by wizards. When you click such a control
and then click the Events tab on the property sheet, the property value
shows [Event Procedure]. When you click [Event Procedure], a
button with an ellipsis (three dots) appears on the right side of the property
value (shown in Figure 1-3). That button is the Build button. Click it to see
the code that executes in response to the selected event.
Look for the
To write custom code for a control, select the control in Design view, open
the property sheet, click the Event tab, click the event to which you want
to attach some custom code, click the Build button, and then choose Code
After you open a module, you’re taken to a separate program window called
Visual Basic Editor (VBE) where you see the module in all its glory. ,
Creating or opening a standard module
Standard modules contain VBA code that isn’t associated with a specific
form or report. The code in a standard module is available to all tables,
queries, forms, reports, macros, and other modules in your database. You
won’t see Module as an option when you’re viewing All Access Objects in the
Navigation Pane until you create at least one standard module. You have to
go looking for options to create and work with modules.
To create a new module, click the Create tab. Then click the Module button
in the Macros & Code group (see Figure 1-4). Visual Basic Editor opens.