Quote:
Originally Posted by missinglinq
For some reason, never have figured out exactly why, sometimes you need to move to the end of the record set before the RecordCount registers correctly. I say sometimes because this is not always true.
Access, like most RDBMSs, will get a number of records when a recordset is opened. It has a threshold number of records that it will grab at opening, for convenience of the user (whether showing the data on the screen or loading into storage within code). It cannot willy-nilly open every recordset and load it all into memory at once. Some datasets are simply too large for that to be practicable.
When getting the record count from a recordset it will return only that number that it already has knowledge of, as in what it has already grabbed. That is why reading to the end will always enable this code to work accurately.
To see this effect, simply open a very large table in your database and notice that the number of records is
not displayed right-away. It will show if you click on the
goto end button, or even if you leave it idle long enough. It does more reading ahead when it detects the system is idle for a while.