You can use the OpenConnection method to open an ADO connection to an existing Microsoft Access project (.adp) or Access database (.mdb) as the current Access project or database in the Microsoft Access window.
Syntax
object.OpenConnection [baseconnectionstring][, userid][, password]
The OpenConnection method has the following arguments.
Argument | Description |
---|---|
object | The CurrentProject or CodeProjectobject. |
baseconnectionstring | A string expression that is the base connection string of the database. |
userid | A string expression that is the name of the existing Access project, 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.adp |
password | Note If you don't supply the filename extension, .adp is appended to the filename. You can use this method or the OpenCurrentDatabase method to open .adp files. |
Remarks
The OpenConnection method is similar to the Open method of an ADO Connection object. This method establishes the physical connection to the data source. After this method successfully completes, the connection is live, the Connection and BaseConnectionString properties are set, and the Database window or data access page should be repopulated with data from the new connection. All parameters of this method are optional. If no base connection string is supplied, then the connection is re-established using the previous base connection string (but the user must call CloseConnection before calling OpenConnection again). In the case of an Access project, the BaseConnectionString property can only specify the SQL Server OLE DB Provider.