G.1. The Application Object

All of the Access objects you'll manipulate within code are children of the Application object, which is the parent object for all objects and collections in the Access object model. Every object and collection is related to the Application object through either a direct parent/child relationship or multiple parent/child relationships. Figure G-1 shows the Access objects and collections that are the direct children of the Application object. The Office 12.0 object library exposes objects from the Application object for each Office application. Because those objects are part of the Office object model, they aren't listed here.

The Application object refers to the currently active Access application. It contains all Microsoft Access objects and collections. You can use the Application object to apply methods or set properties for the entire Access application. For example, you can use the object's SetOption method to control just about all the settings visible in the Access Options dialog box. The various settings you can use with SetOption are listed a little later in this appendix. The following code displays hidden objects in the navigation pane:

Application.SetOption "Show Hidden Objects", True
Figure G.1. Figure G-1

Nearly all code you write in Access utilizes the Application object somewhere within the code.

G.1.1. Application Object Properties ...

Get Access™ 2007 VBA Programmer's Reference 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.