Application object (Access)

The Application object refers to the active Microsoft Access application.

Remarks

The Application object contains all Access objects and collections.

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.

Application.SetOption "Show Status Bar", True

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 an Access database from Visual Basic and work with its objects. From Visual Basic, first create a reference to the Access object library, and 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")

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:

appAccess.DoCmd.OpenForm "Orders"

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.

Methods

Properties

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.