O'Reilly logo

Access 2003 VBA Programmer's Reference by Armen Stein, Graham Seach, Teresa Hennig, Patricia Cardoza

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 within Access

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

2.1.1. Writing Code within Modules

A module is a container for code. You can store various subs, functions, and declarations within a module. To view all modules currently available in your Access database, click the Modules tab of the Access action pane. To view a module, select the module and choose Design from the database window's toolbar (see Figure 2-1).

We'll go into details on the various components of the VBA Editor in the Chapter 4, "VBA Basics," 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 will be listed in the Project Explorer in the upper-left corner of the screen. The Properties dialog box 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 ...

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