ADO » Recordset » ActiveCommand

Set commandobject = recordsetobject. ActiveCommand

Returns a variant that is the Command object associated with the Recordset object.

The ActiveCommand property returns a variant that contains the Command object used to create the Recordset object.

This is a convenient way to find the associated Command object even if you only have the resultant Recordset. However, if the Recordset was not created by a Command object, then a Null object is returned. You can use this property even after the Recordset has been closed.


strCmdText = objRecordset.ActiveCommand.CommandText
strCmdType = objRecordset.ActiveCommand.CommandType

As shown in this example, you can return the value for individual properties of the Command object.