first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

PROBLEM: RecordCount = 1 for a DAO Recordset with More than One Record

If the .RecordCount property of DAO Recordset is equal to 1 and opens without error, then most likely this Recordset is based on Parameters. In order to get an accurate count you will have to resort to using .MoveLast and .MoveFirst in the following manner:

With m_rsDAO
    .MoveLast
    .MoveFirst
    m_lngCount = m_rsDAO.RecordCount
    'etc.
End With

This may be very costly on Recordsets with many rows. If you find this move too expensive, resort to a separate SQL query (or, if you are in a hurry, a Domain Aggregate Function) to return the count.

mod date: 1999-03-05T17:07:10.000Z