Returns or sets a reference to the underlying ADO Recordset object.
Syntax
object.Recordset [= recordset]
The Recordset property syntax has these parts:
Part | Description |
object | An object expression that evaluates to an object in the Applies To list. |
recordset | A recordset object. |
Remarks
Using the Recordset property, you can use the methods, properties, and events of the ADO ADODB.Recordset Object.
You must use the Set statement with the Recordset property, as shown below:
Dim rsNwind As New ADODB.Recordset
' Code to open the ADO Recordset object not shown here.
Set ADODC1.Recordset = rsNwind
If you intend to program the events of the Recordset object, declare an object variable using the WithEvents keyword, as shown below.
Option Explicit
Dim WithEvents rsNames As ADODB.Recordset
Private Sub Form_Load()
Set rsNames = New ADODB.Recordset
' Code to create recordset not shown.
rsNames.MoveFirst ' Move to the beginning of the recordset.
Set ADODC1.Recordset = rsNames
With Text1
Set .DataSource = ADODC1
.DataField = "Name"
End With
End Sub
Private Sub rsNames_FieldChangeComplete(ByVal cFields As Long, _
ByVal Fields As Variant, ByVal pError As ADODB.Error, adStatus As _
ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
Debug.Print "New Name", pRecordset!Name
End Sub