1. Purpose
AbsolutePosition tells you which record (by number) the record pointer is currently on — for example, 1st, 2nd, 3rd, etc.
2. Syntax
rs.AbsolutePosition
or to move to a specific record:
rs.AbsolutePosition = 5
3. Description
-
The first record in the Recordset has a position of 1.
-
If the current position is before the first record, AbsolutePosition returns adPosBOF.
-
If the position is after the last record, it returns adPosEOF.
-
You can use it to identify or return to a particular record.
4. Example
rs.Open "SELECT * FROM Employees", conn, adOpenStatic, adLockReadOnly
rs.MoveFirst
MsgBox "Current record position: " & rs.AbsolutePosition ' Shows 1
rs.MoveNext
MsgBox "Current record position: " & rs.AbsolutePosition ' Shows 2
' Move directly to 5th record
rs.AbsolutePosition = 5
MsgBox "Now on record: " & rs("EmployeeName")
5. Important Notes
-
AbsolutePosition starts from 1, not 0.
-
It is available only for Recordsets that support bookmarks (e.g., adOpenStatic, adOpenKeyset, or adOpenDynamic).
-
It does not work with adOpenForwardOnly cursor type.
-
Useful when:
-
You want to display record numbers (e.g., “Record 3 of 10”).
-
You need to return to a specific record later.
6. Related Property