Seeing Where VBA Lurks

In an Access database, VBA code is stored in modules. Despite the fancy name, a module is basically an electronic sheet of paper on which VBA code is typed. The two types of modules in Access are

^ Standard module: A page that contains VBA code that's accessible to all objects in the database.

^ Class module: A page of code that's attached to every form and report you create. VBA code in the class module is accessible only to the form or report to which the class module is attached.

The main difference between a standard module and a class module is one of scope. VBA code in a standard module has a global scope, which means that the code can be accessed by every object in the database. A class module has a local scope, meaning that its code is accessible only to one form or one report in the database.

I talk about the issue of scope as it becomes relevant throughout this book. Right now, it's not terribly important. For now, the main thing to keep in mind is that modules contain VBA code. Now take a look at where modules are stored within an Access database.

0 0

Post a comment