AbsolutePosition Property

See Also    Example    Applies To

Sets or returns the relative record number of a CdbRecordset object's current record.

Syntax

VOIDSetAbsolutePosition(LONG lPosition);

LONGGetAbsolutePosition(VOID);

Parameters

Type Argument Description
LONG lPosition A Long containing a relative record number from 0 to one less than the number of records in the CdbRecordset.

Remarks

You can use the AbsolutePosition property to position the current record pointer to a specific record based on its ordinal position in a dynaset- or snapshot-type CdbRecordset object. You can also determine the current record number by checking the AbsolutePosition property setting.

Because the AbsolutePosition property value is zero-based (that is, a setting of 0 refers to the first record in the CdbRecordset object), you cannot set it to a value greater than or equal to the number of populated records; doing so causes a trappable error. You can determine the number of populated records in the Recordset object by checking the RecordCount property setting. The maximum allowable setting for the AbsolutePosition property is the value of the RecordCount property minus 1.

If there is no current record, as when there are no records in the CdbRecordset object, AbsolutePosition returns –1. If the current record is deleted, the AbsolutePosition property value isn't defined, and a trappable error occurs if it's referenced. New records are added to the end of the sequence.

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 CdbRecordset 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 CdbRecordset object is re-created again because the order of individual records within a CdbRecordset object isn't guaranteed unless it's created with an SQL statement by using an ORDER BY clause.

Notes