From within MS Access VBA How do I Count records in a recordset not using MoveLast
Posted on 2014-12-13
I have a qdf recordset within MS Access VBA. Using this recordset I am currently doing a
lngRecCount = rstEmployees.RecordCount
I am told I need to move last since the query does not get fully populated until I move last. I also read to avoid this if working with large recordsets. If I am dealing with a large recordset how can I do this efficiently. Note I need to know the record count as I populate a variable with this value.
From MSDN "Using the MoveLast method to populate a newly opened Recordset negatively impacts performance. Unless it is necessary to have an accurate RecordCount as soon as you open a Recordset, it's better to wait until you populate the Recordset with other portions of code before checking the RecordCount property."