Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Application Object

Application Object [Access 2003 VBA Language Reference]

Office 2003
Application
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.



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



Show:
© 2015 Microsoft