Application Object [Access 2003 VBA Language Reference]
The Application object refers to the active Microsoft Access application.
Using the Application Object
The Application object contains all Microsoft Access objects and collections.
You can use the Application object to apply methods or property settings to the entire Microsoft Access application. For example, you can use the SetOption method of the Application object to set database options from Visual Basic. The following example shows how you can set the Status Bar check box under Show on the View tab of the Options dialog box.
Application.SetOption "Show Status Bar", True
Microsoft Access is a COM component that supports Automation, formerly called OLE Automation. You can manipulate Microsoft Access objects from another application that also supports Automation. To do this, you use the Application object.
For example, Microsoft Visual Basic is a COM component. You can open a Microsoft Access database from Visual Basic and work with its objects. From Visual Basic, first create a reference to the Microsoft Office Access 2003 object library. Then create a new instance of the Application class and point an object variable to it, as in the following example:
Dim appAccess As New Access.Application
From applications that don't support the New keyword, you can create a new instance of the Application class by using the CreateObject function:
Dim appAccess As Object Set appAccess = CreateObject("Access.Application")
Once you've created a new instance of the Application class, you can open a database or create a new database, by using either the OpenCurrentDatabase method or the NewCurrentDatabase method. You can then set the properties of the Application object and call its methods. When you return a reference to the CommandBars object by using the CommandBars property of the Application object, you can access all Office 2003 command bar objects and collections by using this reference.
You can also manipulate other Microsoft Access objects through the Application object. For example, by using the OpenForm method of the Microsoft Access DoCmd object, you can open a Microsoft Access form from Microsoft Excel:
For more information on creating a reference and controlling objects by using Automation, see the documentation for the application that's acting as the COM component.