O'Reilly logo

Access™ 2007 VBA Programmer's Reference by Armen Stein, Geoffrey Griffith, Rob Cooper, Teresa Hennig

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

2.1. VBA in Access

If you're reading this book, you've made the decision to use VBA in Access to develop your application. VBA in Access can be implemented in several places, such as writing VBA code in modules and behind controls on forms and reports. You take a quick look at both types of code in this section. Later chapters will provide in-depth coverage of VBA in forms and reports as well as the many different uses of VBA in modules.

2.1.1. Writing Code in Modules

A module is a container for code. You can store various subs, functions, and declarations in a module. To view all modules currently available in your Access database, click the Modules group of the Access navigation pane. To view a module, double-click it to open the Visual Basic Editor (see Figure 2-1).

Chapter 4 explores the various components of the VBA Editor in detail, but you'll notice that by default, the VBA Editor contains a Project Explorer, a Properties dialog box, and the main code editor. If you have various modules available in your project, they are listed in the Project Explorer in the upper-left pane. The Properties pane (lower-right) displays the properties for the currently selected object (either the module itself, or a control or form within the module).

Figure 2.1. Figure 2-1

2.1.2. Writing Code Behind Forms and Reports

Before you dive head first into VBA, you might want to get your feet ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required