Databases Reference
In-Depth Information
adAffectAll
Deletes all records.
adAffectAllChapters
Deletes all chapter records.
GetRows
Retrieves multiple records into an array. The syntax is:
array = recordset.GetRows(
Rows, Start, Fields
)
Rows
is an optional Long parameter that specifies the number of rows to retrieve.
Its default is
adGetRowsRest
, indicating that the method should retrieve all of the
remaining records in the recordset. The optional
Start
parameter specifies the
starting row to retrieve. It should be either a bookmark or one of the values:
adBookmarkCurrent
(start at the current record; this is the default),
adBookmarkFirst
(start at the first record), or
adBookmarkLast
(start at the last
record). Finally,
Fields
can be a single field name (or ordinal position) or an
array of field names (or ordinal positions). If the
Fields
parameter is not missing,
only those fields will be returned; otherwise, all fields will be returned.
Note that the DAO version of the
GetRows
method has a different syntax.
Here are some things to keep in mind concerning the
GetRows
method:
•
The first subscript in the array identifies the field, and the second identifies
the record. This is counterintuitive.
•
The lower bound on the returned array is 0, whereas the upper bound is one
less than the number of records actually returned. Thus, if we specify more
rows than are returned, the upper bound provides a way to get the number
of rows actually returned. (Use the VBA
UBound
function to get the upper
bound, and add 1 to get the number of records returned.)
•
After a call to
GetRows
, the current record is the next unread record, or EOF
if there are no more records. Thus, subsequent calls to
GetRows
can be
made without specifying the
Start
parameter.
Move
,
MoveFirst
,
MoveLast
,
MoveNext
,
MovePrevious
Are used to move the current record pointer.
The
Move
method has the syntax:
recordset.Move
NumRecords, Start