Counting Records

Use the Recordset object's RecordCount property to determine the number of records in a recordset. If the number of records cannot be determined, this property will return -1. The RecordCount property setting depends on the cursor type and the capabilities of the provider. To get the actual count of records, open the recordset with the static (adOpenStatic) or dynamic (adOpenDynamic) cursor.

To quickly test the contents of the recordset, we write the employees' last names to the Immediate window. Since this recordset contains all the fields in the Employees table, you can add extra code to list the remaining field values.

0 0

Post a comment