You can use the Connection property to return a reference to the current ActiveX Data Objects (ADO) Connection object and its related properties.
Setting
[object.]Connection[.method or property]
The Connection property uses the following settings.
Setting | Description |
---|---|
object | The CurrentProject or CodeProject object. |
Connection | Required. When used without specifying a method or property, returns the Connection object's ConnectionString property. |
method or property | A method or property of the Connection object. |
The Connection property is available only by using Visual Basic and is read-only.
Remarks
Use the Connection property of the CurrentProject object to refer to the Connection object of the current Microsoft Access project (.adp) or Access database (.mdb) object. Use the Connection property of the CodeProject object to refer to the Connection object of the Access project or Access database code database object. You can use the Connection property to call methods on the Connection object such as BeginTrans and CommitTrans.
Notes The Connection property actually returns a reference to a copy of the ActiveX Data Object (ADO) connection for the active database. Thus, applying the Close method or in anyway attempting to alter the connection through the Connection object’s methods or properties will have no affect on the actual connection object used by Microsoft Access to hold a live connection to the current database. Since the Connection property is the main Shape provider connection, the following information is necessary when using this property.