Application Object (Access)
The Application object refers to the active Microsoft Access application.
The Application object contains all Access objects and collections.
You can use the Application object to apply methods or property settings to the entire 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 Display Status Bar check box on the Current Database tab of the Access Options dialog box.
Access is a COM component that supports Automation, formerly called OLE Automation. You can manipulate 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 anAccess database from Visual Basic and work with its objects. From Visual Basic, first create a reference to the Access object library. Then create a new instance of the Application class and point an object variable to it, as in the following example:
From applications that do not support the New keyword, you can create a new instance of the Application class by using the CreateObject function:
After you create 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 Microsoft Office command bar objects and collections by using this reference.
You can also manipulate other Access objects through the Application object. For example, by using the OpenForm method of the Access DoCmd object, you can open an Access form from Microsoft Office Excel:
For more information about creating a reference and controlling objects by using Automation, see the documentation for the application that is acting as the COM component.