Move to Absolute Position in DAO

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If you know the absolute position of a row in a recordset, say 2, is it
posibble to move to that position directly?
I can only find MoveNext, MoveLast, MoveFirst etc.

I want to do something like rs2.MoveTo(rp) where rp = 2.

Thanks.
 
The help file indicates that AbsolutePosition for DAO is read/write. To use
it, you need to do a MoveLast to fully populate the recordset first. The
value is zero based.

You may also want to see these warnings from the help file.

You shouldn't use this property as a surrogate record number. Bookmarks are
still the recommended way of retaining and returning to a given position and
are the only way to position the current record across all types of
Recordset objects. In particular, the position of a record changes when one
or more records preceding it are deleted. There is also no assurance that a
record will have the same absolute position if the Recordset object is
re-created again because the order of individual records within a Recordset
object isn't guaranteed unless it's created with an SQL statement by using
an ORDER BY clause.

Notes
Setting the AbsolutePosition property to a value greater than zero on a
newly opened but unpopulated Recordset object causes a trappable error.
Populate the Recordset object first with the MoveLast method.

The AbsolutePosition property isn't available on forward-only-type Recordset
objects, or on Recordset objects opened from pass-through queries against
Microsoft Jet-connected ODBC databases.
 
Back
Top