MoveFirst and MoveLast methods are used to navigate within a Recordset. They move the record pointer to the first or last record, respectively.
1. MoveFirst
2. MoveLast
3. Cursor Type Requirement
To use MoveFirst, MoveLast, MovePrevious, etc., the Recordset must have a scrollable cursor type.
For example:
rs.Open "SELECT * FROM Employees", conn, adOpenStatic, adLockReadOnly
Here, adOpenStatic supports both forward and backward navigation.
4. Summary Table
| Method |
Moves Pointer To |
Requires Scrollable Cursor |
Typical Use |
MoveFirst |
First record |
Yes |
Start reading from beginning |
MoveLast |
Last record |
Yes |
Go directly to end or count total records |