Class Application (Access VBA)

The Application object refers to the active Microsoft Access application.

Methods

Echo - The Echo method specifies whether Microsoft Access repaints the display screen.


Public Sub EchoOff() 
 
 ' Open the Employees form minimized. 
 Application.Echo False 
 DoCmd.Hourglass True 
 DoCmd.OpenForm "Employees", acNormal 
 DoCmd.Minimize 
 Application.Echo True 
 DoCmd.Hourglass False 
 
End Sub

FollowHyperlink - The FollowHyperlink method opens the document or webpage specified by a hyperlink address.


Function GetUserAddress() As Boolean 
    Dim strInput As String 
 
    On Error GoTo Error_GetUserAddress 
    strInput = InputBox("Enter a valid address") 
    Application.FollowHyperlink strInput, , True 
    GetUserAddress = True 
 
Exit_GetUserAddress: 
    Exit Function 
 
Error_GetUserAddress: 
    MsgBox Err & ": " & Err.Description 
    GetUserAddress = False 
    Resume Exit_GetUserAddress 
End Function

Run - You can use the Run method to carry out a specified Microsoft Access or user-defined Function or Sub procedure.


Dim appAccess As New Access.Application 
appAccess.OpenCurrentDatabase ("C:\My Documents\WizCode.mdb") 
appAccess.Run "WizCode.NewForm", "Some String"

AccessError - You can use the AccessError method to return the descriptive string associated with a Microsoft Access or Data Access Objects (DAO) error.

AddToFavorites - The AddToFavorites method adds a hyperlink address to the Favorites folder.

BuildCriteria - The BuildCriteria method returns a parsed criteria string as it would appear in the query design grid, in Filter By Form or Server Filter By Form mode. For example, you may want to set a form's Filter or ServerFilter property based on varying criteria from the user. You can use the BuildCriteria method to construct the string expression argument for the Filter or ServerFilter property.

CloseCurrentDatabase - You can use the CloseCurrentDatabase method to close the current database, either a Microsoft Access database or an Access project (.adp) from another application that has opened a database through Automation.

CodeDb - You can use the CodeDb method in a code module to determine the name of the Database object that refers to the database in which code is currently running. Use the CodeDb method to access Data Access Objects (DAO) that are part of a library database.

ColumnHistory - Gets the history of values that have been stored in a Memo field.

CompactRepair -

ConvertAccessProject - Converts the specified Microsoft Access file from one version to another.

CreateAccessProject - You can use the CreateAccessProject method to create a new Microsoft Access project (.adp) on disk.

CreateAdditionalData - Creates an AdditionalData object that can be used to add additional tables and queries to the parent table that is being exported by the ExportXML method.

CreateControl - The CreateControl method creates a control on a specified open form. For example, suppose you are building a custom wizard that allows users to easily construct a particular form. You can use the CreateControl method in your wizard to add the appropriate controls to the form.

CreateForm - The CreateForm method creates a form and returns a Form object.

CreateGroupLevel - You can use the CreateGroupLevel method to specify a field or expression on which to group or sort data in a report.

CreateReport - The CreateReport method creates a report and returns a Report object. For example, suppose you are building a custom wizard to create a sales report. You can use the CreateReport method in your wizard to create a new report based on a specified report template.

CreateReportControl - The CreateReportControl method creates a control on a specified open report. For more information, see the CreateControl method.

CurrentDb - The CurrentDb method returns an object variable of type Database that represents the database currently open in the Microsoft Access window.

CurrentUser - You can use the CurrentUser method to return the name of the current user of the database.

CurrentWebUser - Gets information about the current user of a web database on Microsoft SharePoint Foundation 2010 and later.

CurrentWebUserGroups - Gets the collection of Microsoft SharePoint Foundation groups of which the user is a member.

DAvg - You can use the DAvg function to calculate the average of a set of values in a specified set of records (a domain).

DCount - You can use the DCount function to determine the number of records that are in a specified set of records (a domain).

DDEExecute - You can use the DDEExecute statement to send a command from a client application to a server application over an open dynamic data exchange (DDE) channel.

DDEInitiate - You can use the DDEInitiate function to begin a dynamic data exchange (DDE) conversation with another application. The DDEInitiate function opens a DDE channel for transfer of data between a DDE server and a client application.

DDEPoke - You can use the DDEPoke statement to supply text data from a client application to a server application over an open dynamic data exchange (DDE) channel.

DDERequest - You can use the DDERequest function over an open dynamic data exchange (DDE) channel to request an item of information from a DDE server application.

DDETerminate - You can use the DDETerminate statement to close a specified dynamic data exchange (DDE) channel.

DDETerminateAll - You can use the DDETerminateAll statement to close all open dynamic data exchange (DDE) channels.

DefaultWorkspaceClone - You can use the DefaultWorkspaceClone method to create a new Workspace object without requiring the user to sign in again. For example, if you need to conduct two sets of transactions simultaneously in separate workspaces, you can use the DefaultWorkspaceClone method to create a second Workspace object with the same user name and password without prompting the user for this information again.

DeleteControl - The DeleteControl method deletes a specified control from a form.

DeleteReportControl - The DeleteReportControl method deletes a specified control from a report.

DFirst - You can use the DFirst function to return a random record from a particular field in a table or query when you need any value from that field.

DirtyObject - Marks a form or report as dirty.

DLast - You can use the DLast function to return a random record from a particular field in a table or query when you need any value from that field.

DLookup - You can use the DLookup function to get the value of a particular field from a specified set of records (a domain).

DMax - You can use the DMax function to determine the maximum value in a specified set of records (a domain).

DMin - You can use the DMin function to determine the minimum value in a specified set of records (a domain).

DStDev - Estimates the standard deviation across a population sample in a specified set of records (a domain).

DStDevP - Estimates the standard deviation across a population in a specified set of records (a domain).

DSum - You can use the DSum function to calculate the sum of a set of values in a specified set of records (a domain).

DVar - Estimates the variance across a sample in a specified set of records (a domain).

DVarP - Calculates the variance of a population in a specified set of records (a domain).

EuroConvert - You can use the EuroConvert function to convert a number to euro, or from euro to a participating currency. You can also use it to convert a number from one participating currency to another by using the euro as an intermediary (triangulation). The EuroConvert function uses fixed conversion rates established by the European Union.

Eval - You can use the Eval function to evaluate an expression that results in a text string or a numeric value.

ExportNavigationPane - Saves the current configuration of the navigation pane to an XML file.

ExportXML - The ExportXML method allows developers to export XML data, schemas, and presentation information from Microsoft SQL Server 2000 Desktop Engine (MSDE 2000), Microsoft SQL Server 6.5 or later, or the Microsoft Access database engine.

GetHiddenAttribute - The GetHiddenAttribute method returns the value of a hidden attribute of a Microsoft Access object in the object's Properties dialog box, available by selecting the object in the Database window and choosing Properties on the View menu.

GetOption - The GetOption method returns the current value of an option in the Access Options dialog box, available by choosing the Microsoft Office button, and then choosing Access Options.

GUIDFromString - The GUIDFromString function converts a string to a GUID, which is an array of type Byte.

HtmlEncode - Converts a string to an HTML-encoded string.

hWndAccessApp - You can use the hWndAccessApp method to determine the handle assigned by Windows to the main Microsoft Access window.

HyperlinkPart - The HyperlinkPart method returns information about data stored as a Hyperlink data type.

ImportNavigationPane - Loads a saved navigation pane configuration from disk.

ImportXML - The ImportXML method allows developers to import XML data and/or schema information into Microsoft SQL Server 2000 Desktop Engine (MSDE 2000), Microsoft SQL Server 7.0 or later, or the Microsoft Access database engine.

InstantiateTemplate - Opens a new database and applies the specified template.

IsCurrentWebUserInGroup - Gets whether or not the current user of a web database is a member of the specified Microsoft SharePoint Foundation 2010 group.

LoadCustomUI - Loads XML markup that represents a customized ribbon.

LoadFromAXL - Imports the object defined in an Application XML (AXL) file into the database.

LoadPicture - The LoadPicture method loads a graphic into an ActiveX control.

NewAccessProject - You can use the NewAccessProject method to create and open a new Microsoft Access project (.adp) as the current Access project in the Access window.

NewCurrentDatabase - Creates a new Microsoft Access database.

Nz - You can use the Nz function to return zero, a zero-length string (" "), or another specified value when a Variant is Null. For example, you can use this function to convert a Null value to another value and prevent it from propagating through an expression.

OpenAccessProject - You can use the OpenAccessProject method to open an existing Microsoft Access project (.adp) as the current Access project in the Access window.

OpenCurrentDatabase - You can use the OpenCurrentDatabase method to open an existing Microsoft Access database as the current database.

PlainText - Strips the rich text formatting from a string and returns an unformatted text string.

Quit - The Quit method quits Microsoft Access. You can select one of several options for saving a database object before quitting.

RefreshDatabaseWindow - The RefreshDatabaseWindow method updates the Database window after a database object has been created, deleted, or renamed.

RefreshTitleBar - The RefreshTitleBar method refreshes the Microsoft Access title bar after the AppTitle or AppIcon property has been set in Visual Basic.

RunCommand - The RunCommand method runs a built-in command.

SaveAsAXL - Exports the specified object to an Application XML (AXL) file.

SaveAsTemplate - Converts an existing Microsoft Access database file to a database template (*.accdt) format file.

SetDefaultWorkgroupFile - Sets the default workgroup file to the specified file.

SetHiddenAttribute - The SetHiddenAttribute method sets the hidden attribute of an Access object.

SetOption - The SetOption method sets the current value of an option in the Access Options dialog box.

StringFromGUID - The StringFromGUID function converts a GUID, which is an array of type Byte, to a string.

SysCmd - You can use the SysCmd method to display a progress meter or optional specified text in the status bar, return information about Microsoft Access and its associated files, or return the state of a specified database object (to indicate whether the object is open, is a new object, or has been changed but not saved).

TransformXML - Applies an Extensible Stylesheet Language (XSL) stylesheet to an XML data file and writes the resulting XML to an XML data file.

Properties

Assistance returns an IAssistance object that represents the Microsoft Office Help Viewer.

AutoCorrect returns an AutoCorrect object that represents the AutoCorrect settings for Microsoft Access.

AutomationSecurity returns or sets an MsoAutomationSecurity constant that represents the security mode that Microsoft Access uses when it is programmatically opening files.

BrokenReference returns a Boolean indicating whether the current database has any broken references to databases or type libraries. True if there are any broken references.

Build returns as a Long representing the build number of the currently installed copy of Microsoft Access.

CodeContextObject you can use the CodeContextObject property to determine the object in which a macro or Visual Basic code is executing.

CodeData you can use the CodeData property to access the CodeData object and its related collections.

CodeProject you can use the CodeProject property to access the CodeProject object and its related collections, properties, and methods.

COMAddIns you can use the COMAddIns property to return a reference to the current COMAddIns collection object and its related properties.

CommandBars you can use the CommandBars property to return a reference to the CommandBars collection object.

CurrentData you can use the CurrentData property to access the CurrentData object and its related collections.

CurrentObjectName you can use the CurrentObjectName property with the Application object to determine the name of the active database object. The active database object is the object that has the focus or in which code is running.

CurrentObjectType you can use the CurrentObjectType property together with the Application object to determine the type of the active database object (table, query, form, report, macro, module, server view, database diagram, or stored procedure). The active database object is the object that has the focus or in which code is running.

CurrentProject you can use the CurrentProject property to access the CurrentProject object and its related collections, properties, and methods.

DBEngine you can use the DBEngine property in Visual Basic to access the current DBEngine object and its related properties.

DoCmd you can use the DoCmd property to access the read-only DoCmd object and its related methods.

FeatureInstall you can use the FeatureInstall property to specify or determine how Microsoft Access handles calls to methods and properties that require features not yet installed.

FileDialog returns a FileDialog object that represents a single instance of a file dialog box.

Forms you can use the Forms property to return a read-only reference to the Forms collection and its related properties.

IsCompiled the IsCompiled property returns a Boolean value indicating whether the Visual Basic project is in a compiled state.

LanguageSettings you can use the LanguageSettings property to return a read-only reference to the current LanguageSettings object and its related properties.

MacroError returns a MacroError object that contains information about the latest error to occur in a macro.

MenuBar specifies a custom menu to display for a Microsoft Access database.

Modules you can use the Modules property to access the Modules collection and its related properties.

Name you can use the Name property to determine the string expression that identifies the name of an object.

NewFileTaskPane returns a NewFile object that represents a document listed on the New File task pane.

Printers returns the Printers collection representing all the available printers on the current system.

ProductCode you can use the ProductCode property to determine the Microsoft Access globally unique identifier (GUID).

References you can use the References property to access the References collection and its related properties, methods, and events.

Reports you can use the Reports property to access the read-only Reports collection and its related properties.

ReturnVars returns the ReturnVars collection representing all the available ReturnVar variables.

Screen you can use the Screen property to return a reference the Screen object and its related properties.

ShortcutMenuBar you can use the ShortcutMenuBar property to specify the shortcut menu that appears when you right-click the specified object.

TempVars returns the collection of TempVar objects.

UserControl you can use the UserControl property to determine whether the current Microsoft Access application was started by the user or by another application with Automation, formerly called OLE Automation.

VBE you can use the VBE property to return a reference to the current VBE object and its related properties. The VBE property of the Application object represents the Microsoft Visual Basic for Applications editor.

Version returns a String indicating the version number of the currently installed copy of Microsoft Access.

Visible returns or sets whether a Microsoft Access application is minimized.

WebServices gets the collection of installed Data Service data connections.

AdditionalData - Represents the collection of tables and queries that will be included with the parent table that is exported by the ExportXML method.

AutoCorrect - The AutoCorrect object represents the AutoCorrect functionality of Microsoft Access.

CodeData - The CodeData object refers to objects stored within the code database by the source (server) application.

CodeProject - The CodeProject object refers to the project for the code database of a Microsoft Access project (.adp) or Access database.

Control - The Control object represents a control on a form, report, or section, within another control, or attached to another control.

CurrentData - The CurrentData object refers to the objects stored in the current database by the source (server) application.

CurrentProject - The CurrentProject object refers to the project for the current Microsoft Access project (.adp) or Access database.

DoCmd - You can use the methods of the DoCmd object to run Microsoft Office Access actions from Visual Basic. An action performs tasks such as closing windows, opening forms, and setting the value of controls.

Form - A Form object refers to a particular Microsoft Access form.

Forms - The Forms collection contains all the currently open forms in a Microsoft Access database.

MacroError - Represents the properties of a run-time error that occurs in a macro.

Modules - The Modules collection contains all open standard modules and class modules in a Microsoft Access database.

Printers - The Printers collection contains Printer objects representing all the printers available on the current system.

References - The References collection contains Reference objects representing each reference that's currently set.

Report - A Report object refers to a particular Microsoft Access report.

Reports - The Reports collection contains all of the currently open reports in a Microsoft Access database.

ReturnVars - Represents the collection of ReturnVar objects.

Screen - The Screen object refers to the particular form, report, or control that currently has the focus.

TempVars - Represents the collection of TempVar objects.

WebServices - Represents the collection of Data Services data connections installed in the database.