ADO » Recordset » RecordCount

long = recordsetobject.RecordCount

Returns a long value that is the count of how many records are in a Recordset

The RecordCount property returns a long value that is the number of records in the Recordset object. The Recordset must be open to use this property, otherwise a run-time error will be generated. If the provider does not support this property or the count cannot be done, a value of -1 will be returned.

The type of cursor being used by the Recordset affects whether this property can return a valid count. In general, you can obtain the actual count for a keyset and static cursor. However, you may get either a -1 or the count if a dynamic cursor is being used, and you cannot get a count if a forward-only cursor is being used (-1 is returned).


rsChants.Open strQuery, , , adCmdTable
If rsChants.Supports(adBookmark) = True Then
   intRecordCnt = rsChants.RecordCount
End If

See Also: