Microsoft Office Tutorials and References
In Depth Information
Chapter 5: Using SQL and Recordsets
.MoveLast: Moves the cursor to the last record in the recordset
.Move numrecords, start Specifies the number of records to move :
through and the starting point
.Open: Opens a new recordset
.Close: Closes a recordset
.Update: Saves any changes made to the current row of a recordset
.UpdateBatch: Saves all changes made to the current recordset
Following are some properties you can use to determine the number of
records in a recordset, as well as the current position of the cursor within
the recordset:
.RecordCount: Returns the total number of records in the recordset
.AbsolutePosition: Returns a number indicating which row the
cursor is in (1 for the first record, 2 for the second record, and so on)
.BOF (Beginning of File): Returns True when the cursor is above the
first record in the recordset
.EOF (End of File): Returns True when the cursor is past the last record
in the recordset
Looping through a recordset
When a recordset is open, you can use a loop to step through each record
within it. As an example, Figure 5-2 shows some code that creates a
recordset named myRecordset. The While...Wend loop steps through each
record in the recordset — one record at a time — and then prints the record’s
position and the contents of the first couple of fields in each record.
Chapter 5
Figure 5-2:
Sample sub
records in a
Search JabSto ::

Custom Search