Application Object [Access 2003 VBA Language Reference]

Multiple objects

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:

appAccess.DoCmd.OpenForm "Orders"

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.

Properties | AnswerWizard Property | Assistant Property | AutoCorrect Property | AutomationSecurity Property | BrokenReference Property | Build Property | CodeContextObject Property | CodeData Property | CodeProject Property | COMAddIns Property | CommandBars Property | CurrentData Property | CurrentObjectName Property | CurrentObjectType Property | CurrentProject Property | DataAccessPages Property | DBEngine Property | DefaultWebOptions Property | DoCmd Property | FeatureInstall Property | FileDialog Property | FileSearch Property | Forms Property | IsCompiled Property | LanguageSettings Property | MenuBar Property | Modules Property | Name Property | NewFileTaskPane Property | Printer Property | Printers Property | ProductCode Property | References Property | Reports Property | Screen Property | ShortcutMenuBar Property | UserControl Property | VBE Property | Version Property | Visible Property

Methods | AccessError Method | AddToFavorites Method | BuildCriteria Method | CloseCurrentDatabase Method | CodeDb Method | CompactRepair Method | ConvertAccessProject Method | CreateAccessProject Method | CreateAdditionalData Method | CreateControl Method | CreateForm Method | CreateGroupLevel Method | CreateNewWorkgroupFile Method | CreateReport Method | CreateReportControl Method | CurrentDb Method | CurrentUser Method | DAvg Function | DCount Function | DDEExecute Method | DDEInitiate Function | DDEPoke Method | DDERequest Function | DDETerminate Method | DDETerminateAll Method | DefaultWorkspaceClone Method | DeleteControl Method | DeleteReportControl Method | DFirst, DLast Functions | DFirst, DLast Functions | DLookup Function | DMin, DMax Functions | DMin, DMax Functions | DStDev, DStDevP Functions | DStDev, DStDevP Functions | DSum Function | DVar, DVarP Functions | DVar, DVarP Functions | Echo Method | EuroConvert Function | Eval Function | ExportXML Method | FollowHyperlink Method | GetHiddenAttribute Method | GetOption Method | GUIDFromString Function | hWndAccessApp Method | HyperlinkPart Method | ImportXML Method | LoadPicture Method | NewAccessProject Method | NewCurrentDatabase Method | Nz Function | OpenAccessProject Method | OpenCurrentDatabase Method | Quit Method | RefreshDatabaseWindow Method | RefreshTitleBar Method | Run Method | RunCommand Method | SetDefaultWorkgroupFile Method | SetHiddenAttribute Method | SetOption Method | StringFromGUID Function | SysCmd Method | TransformXML Method

Parent Objects

Child Objects | CodeData Object | CodeProject Object | CurrentData Object | CurrentProject Object | DataAccessPages Object | DefaultWebOptions Object | DoCmd Object | Forms Object | Modules Object | Printers Object | References Object | Reports Object | Screen Object

See Also | DoCmd Object | Forms Collection | Module Object | Modules Collection | References Collection | Reports Collection | Screen Object