Skip to Content
Access™ 2007 VBA Programmer's Reference
book

Access™ 2007 VBA Programmer's Reference

by Teresa Hennig, Rob Cooper, Geoffrey Griffith, Armen Stein
May 2007
Intermediate to advanced
1152 pages
30h 53m
English
Wrox
Content preview from Access™ 2007 VBA Programmer's Reference

13.3. Creating a Class Module

Everyone learns best by doing, so to learn the basics of creating a class module, you'll create one. The class module will model a classroom at a school. You'll see this example throughout the chapter, showing the different parts of a class module and how to model its relationships with other classes.

13.3.1. Adding a Class Module to the Project

The easiest way to add a new class module to your project is to press Alt+F11 to open the Visual Basic Editor. Then, in the Visual Basic designer window, select Insert Class Module. You can also right-click anywhere in the Project Explorer and select Insert Class Module from the context menu. In addition, you can also create a class module from within Access by selecting Class Module under the Macro split button in the Other group in the Ribbon's Create tab.

VBA opens a new class module and adds a reference to it in the Project Explorer. Copy the clsClassroom code into the module as shown in Figure 13-3. That's it! You've created your first class module!

Figure 13.3. Figure 13-3

13.3.2. A Brief Word on Naming the Class

All things have names, and class modules are no different. The name you give a class module, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Excel® 2007 VBA Programmer's Reference

Excel® 2007 VBA Programmer's Reference

John Green, Stephen Bullen, Rob Bovey, Michael Alexander
Access 2003 VBA Programmer's Reference

Access 2003 VBA Programmer's Reference

Patricia Cardoza, Teresa Hennig, Graham Seach, Armen Stein
Microsoft® Access® 2010 Programmer's Reference

Microsoft® Access® 2010 Programmer's Reference

Teresa Hennig, Rob Cooper, Geoffrey L. Griffith, Jerry Dennison

Publisher Resources

ISBN: 9780470047033Purchase book