Click to See Complete Forum and Search --> : Record Count Of A MDB file


2MuchRiceMakesMeSick
November 22nd, 2006, 09:34 PM
How can I tell how many records are in a MDB file using visual c++ MFC CDaoRecordset.

hmc
November 28th, 2006, 10:23 AM
Select all records from a table in a recordset with "SELECT * FROM tbl" and use a function like GetRecordCount() or something.

Or do you mean from all tables together?

2MuchRiceMakesMeSick
December 2nd, 2006, 01:12 PM
No i just need the number of records in one table but getrecordcount() only works when you have looped trough all of the records. I was wondering how you get them before you loop so I do not have to loop through twice.

Vanaj
December 2nd, 2006, 04:11 PM
Try thisSELECT Count(*)

aniskhan
December 3rd, 2006, 07:11 AM
this will be faster instead of using count(*)
SELECT COUNT(IdColumn) FROM MyTable

Vanaj
December 3rd, 2006, 11:50 AM
this will be faster instead of using count(*)
SELECT COUNT(IdColumn) FROM MyTableAs long as IdColumn is not a NULL then the count will correct else it will not count the record if IdCulumn is a NULL value, thus the reason for COUNT(*) as this will count all records even NULL ones.