<< Click to Display Table of Contents >>
GetADORecordSet |
The Query's GetADORecordSet method returns a Recordset of type ADO (ActiveX Data Object), resulting from the execution of a configured Query.
The ADORecordset object is used to access records from a database table and contain the properties and methods described on the next tables.
Properties of an ADORecordset object
Name |
Description |
---|---|
BOF |
Returns True if pointer's position is before the first record |
EOF |
Returns True if pointer's position is after the last record |
RecordCount |
Returns the number of records on a table |
Methods of an ADORecordset object
Name |
Description |
---|---|
MoveFirst |
Moves the pointer to the first record |
MoveLast |
Moves the pointer to the last record |
MoveNext |
Moves the pointer to the next record |
MovePrevious |
Moves the pointer to the previous record |
To access records individually, use the Fields("FieldName") command, according to the next example.
Set RS = Screen.Item("Query1").GetADORecordset()
For i = 1 To RS.RecordCount
Field1 = RS.Fields("Field1").Value
Field2 = RS.Fields("Field2").Value
Field3 = RS.Fields("Field3").Value
MsgBox Field1 & vbTab & Field2 & vbTab & Field3
Next