Understanding the Role of Class Modules

Class modules, which were introduced by Visual Basic 4.0, are containers for VBA code that relate to a particular class of objects. Access 97 defines two classes (collections)—Forms and Reports—that contain VBA code for a particular instance of the class: a Form or Report object, respectively. In object-oriented programming terms, class modules encapsulate VBA code within a Form or Report object. Code encapsulation lets you create reusable objects. For example, when you copy a form from one Access database to another, the copy you make includes the code in the form's class module.

Access's Form and Report class modules differ from conventional modules in that a Form or Report object is integral to the ...

Get Special Edition Using Access 97, Second Edition 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.