RecordCount Property

   

Returns the number of records accessed in a CdbRecordset object or the total number of records in a table-type CdbRecordset or CdbTableDef object.

Syntax

LONGGetRecordCount(VOID);

Remarks

Use the RecordCount property to find out how many records in a CdbRecordset or CdbTableDef object have been accessed. The RecordCount property doesn't indicate how many records are contained in a dynaset-, snapshot-, or forward-only–type CdbRecordset object until all records have been accessed. Once the last record has been accessed, the RecordCount property indicates the total number of undeleted records in the CdbRecordset or CdbTableDef object. To force the last record to be accessed, use the MoveLast method on the CdbRecordset object. You can also use an SQL Count function to determine the approximate number of records your query will return.

Note Using the MoveLast method to populate a newly opened CdbRecordset negatively impacts performance. Unless it is necessary to have an accurate RecordCount as soon as you open a CdbRecordset, it's better to wait until you populate the CdbRecordset with other portions of code before checking the RecordCount property.

As your application deletes records in a dynaset-type CdbRecordset object, the value of the RecordCount property decreases. However, records deleted by other users aren't reflected by the RecordCount property until the current record is positioned to a deleted record. If you execute a transaction that affects the RecordCount property setting and you subsequently roll back the transaction, the RecordCount property won't reflect the actual number of remaining records.

The RecordCount property of a snapshot- or forward-only–type CdbRecordset object isn't affected by changes in the underlying tables.

A CdbRecordset or CdbTableDef object with no records has a RecordCount property setting of 0.

When you work with linked CdbTableDef objects, the RecordCount property setting is always –1.

Using the Requery method on a CdbRecordset object resets the RecordCount property just as if the query were re-executed.