totn Access 2007 VBA Environment

MS Access 2007: Objects Displayed in VBA Environment

This MSAccess tutorial explains what objects are displayed in the VBA environment in Access 2007 (with screenshots and step-by-step instructions).

Objects displayed in the Project Explorer

Microsoft Access

The next important aspect to discuss is what objects appear in the Project Explorer.

At first glance, you'd assume that all of the Forms, Reports, and Modules that you create will automatically appear in the Project Explorer. But this is not true. The VBA environment only knows about the objects that you tag as "having a module".

So by default, all Modules will appear in the Project Explorer, but not all Forms and Reports necessarily will.

A Form will only appear in the Project Explorer if the Form's "Has Module" property is set to "Yes".

Microsoft Access

Similarly, a Report will only appear in the Project Explorer if the Report's "Has Module" property is set to "Yes".

Microsoft Access

Now, you're probably asking yourself, "How come some of the forms and reports in my Access database have the "Has Module" property set to "Yes" and others don't?"

Well, anytime that you invoke the Code Builder in a Form/Report, Access automatically sets Form/Report's "Has Module" property to "Yes".

Microsoft Access

Therefore, if you want to reference one of your Forms or Reports in the VBA environment, you may need to manually go to the Form/Report's Properties window and set the "Has Module" property to "Yes".

Congratulations! You've just completed the tutorial on understanding the VBA environment.