The Recordset object provides methods for manipulating result sets. It allows you to add, update, delete, and scroll through records in the recordset.
A Recordset object can be created through the Execute method of the Connection or Command object.
Each record in a recordset can also be retrieved and updated by using the Fields collection and the Field object. Updates on the Recordset object can be in an immediate or batch mode. When a Recordset object is created, a cursor is opened automatically.
The Recordset object allows you to specify the cursor type and location for fetching the result set. With the CursorType property, you can specify whether the cursor is read-only, forward-only, static, keyset-driven, or dynamic. Cursor type determines whether a Recordset object can be scrolled or updated and also affects the visibility of changed records. By default, the cursor type is read-only and forward-only.
Specify the location of the cursor engine with the CursorLocation property. This property lets you specify whether to use a client or server cursor. The CursorLocation property setting is important when you use disconnected recordsets.
The first part of the ADO Introductory Visual Basic Sample’s cmdExecute_Click method shows an example of creating, opening, passing a command string variable to, and positioning the cursor in a recordset.
Dim cn As New ADODB.Connection
Dim rs As ADODB.Recordset
. . .
cmd1 = txtQuery.txt
Set rs = New ADODB.Recordset
rs.Open cmd1, cn
rs.MoveFirst
. . .
' Code to loop through result set(s)