ADO Recordset Object >>
ActiveConnection Property
The ActiveConnection property sets or returns a variant defining the
Connection object to which the Recordsetbelongs, or returns a string
value if there is no connection.
The ActiveConnection property can be used to determine what Connection
object is associated with the Recordset object. If the connection is
closed, you can set or return a connection string that defines the
connection. If the connection is open, you can set or return a variant
that contains the Connection object associated with the Recordset. The
default is a Null object reference. A client-side Recordset can only be
set to a connection string or to Nothing.
Setting this property to Nothing will disconnect the Recordset from the
database. Since the Recordset will still exist, the contents can be
examined. Also, it can later be reconnected.
If you set this property to a valid connection string or to a valid
Connection object, then the provider will create a new Connection object
and open the connection.
The ActiveConnection property can inherit the value of the
ActiveConnection parameter of the Open method. In a similar fashion, the
ActiveConnection property of the Recordset inherits the value of the
ActiveConnection property of the Command object if the Source property
of the Recordset object is set to a valid Command object.
Syntax
set recordsetobject.ActiveConnection = variant or string
recordsetobject.AbsoluteConnection = string
|
Example
Set objRecordset. ActiveConnection = objConnecion
OR
objRecordset. ActiveConnection = strConnecion
|
|