When you first Open Recordset(), Access grabs the first record, and keeps processing your code while the others load.So, if you test Record Count immediately after you Open Recordset, you typically get 0 (if there are no records), or 1 (if there are any, regardless of how many will load.) This does not apply to recordsets of type db Open Table type (the default for local tables.) If you need to know the Record Count, use the Move Last method first.See Solving Problems with Library References for details. To ensure your code works reliably: There are different types of DAO recordset, with different methods.When you Open Recordset() on a query or attached table, Access defaults to a Dynaset type (db Open Dynaset).Failure to test for these conditions means your code works for most cases, but generates an error one day when the last/first record is accessed.
Example: Using any of the Move methods (Move First, Move Last, Move Next, or Move Previous) causes an error if the recordset has no records. Either of these approaches works: For recordsets based on queries, SQL statements, and attached tables, the Record Count property returns the number of records accessed so far.
Your program then fails, or returns inaccurate results.
The DAO and ADO libraries both have a Recordset object, but with different methods, properties, and options.
The simplest reports every 100th record in the loop like this: If you use Seek or one of the Find methods (Find First, Find Last, Find Next, Find Previous), and do not test No Match, your code will appear to work until you strike a case where the find failed.
Always test for No Match after using Seek or a Find method.
Specifically test for and handle the complex data types if your code must work with databases in Access 2007 or later.