Argument | Description |
application | The Application object. |
Dbname | A string expression that is the name of an existing database file, including the path name and the file name extension. If your network supports it, you can also specify a network path in the following form: \\Server\Share\Folder\Filename.mdb |
exclusive | Optional. A Boolean value that specifies whether you want to open the database in exclusive mode. The default value is False, which specifies that the database should be opened in shared mode. |
' Include following in Declarations section of module.
Dim appAccess As Access.Application
Sub DisplayForm()
Const strConPathToSamples = _
"C:\Program Files\MSOffice\Access\Samples\"
Dim strDB As String
' Initialize string to database path.
strDB = strConPathToSamples & "Northwind.mdb"
' Create new instance of Microsoft Access.
Set appAccess = _
CreateObject("Access.Application.8")
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strDB
' Open Orders form.
appAccess.DoCmd.OpenForm "Orders"
End Sub
Note From some applications, such as Microsoft Visual Basic, you can include the New keyword when declaring the Application object variable. This keyword automatically creates a new instance of Microsoft Access, without requiring you to use the CreateObject function. Check your application's documentation to determine whether it supports this syntax.