Name

Recordset.RecordCount Property — (Versions 2.0, 2.1, 2.5, 2.6)

Synopsis

                     recordcount = recordset.RecordCount

The RecordCount property returns the number of records in the current Recordset object.

Datatype

Long

Description

If the provider or the cursor does not support the RecordCount property, or if the number of records cannot be determined by ADO, -1 is returned.

The actual number of records is always returned by the RecordCount property for Keyset or Static cursors, but -1 is always returned for a Forward Only cursor. Dynamic cursors can return either -1 or the actual number of records, depending upon the data source.

The RecordCount efficiently reports the number of records in a recordset only if the current Recordset object supports approximate positioning (Supports -- adApproxPosition) or bookmarks (Supports -- adBookmark); otherwise, this property uses a lot of resources because ADO must load all of the records to count them.

Get ADO: ActiveX Data Objects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.