KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q165563: INFO: GetRecordCount May Not Return Correct Number of Records

Article: Q165563
Product(s): Microsoft C Compiler
Version(s): 4.0 4.1 4.2 5.0 6.0
Operating System(s): 
Keyword(s): kbusage kbDAOsearch kbDatabase kbMFC kbVC kbVC400 kbVC410 kbVC420 kbVC500 kbVC600
Last Modified: 04-AUG-2001

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Visual C++, versions 4.0, 4.1 
- Microsoft Visual C++, 32-bit Enterprise Edition, versions 4.2, 5.0, 6.0 
- Microsoft Visual C++, 32-bit Professional Edition, versions 4.2, 5.0, 6.0 
- Microsoft Visual C++, 32-bit Learning Edition, version 6.0 
-------------------------------------------------------------------------------

SUMMARY
=======

CDaoRecordset::GetRecordCount is not guaranteed to return the correct number of
rows for a table-type recordset even if you call this function after calling
MoveLast().

MORE INFORMATION
================

You can call CDaoRecordset::GetRecordCount to find out how many records in a
recordset have been accessed. GetRecordCount does not indicate how many records
are contained in a dynaset-type or snapshot-type recordset until all records
have been accessed. To force the last record to be accessed, call the MoveLast
function.

The value of GetRecordCount from a table-type recordset reflects the approximate
number of records in the table.


To get an accurate record count, open a dynaset- or snapshot-type recordset and
then do a MoveLast. Table-type recordsets will be accurate immediately after the
database has been compacted or repaired.

REFERENCES
==========

Visual C++ Help; search on: CDaoRecordset::GetRecordCount

Additional query words:

======================================================================
Keywords          : kbusage kbDAOsearch kbDatabase kbMFC kbVC kbVC400 kbVC410 kbVC420 kbVC500 kbVC600 
Technology        : kbVCsearch kbVC400 kbAudDeveloper kbVC410 kbVC420 kbVC500 kbVC600 kbVC32bitSearch kbVC500Search
Version           : 4.0 4.1 4.2 5.0 6.0

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.