Depending on how you open the Recordset, the record pointer usually sits on the first record. That is why the recordcount is 1. To get the correct count, you'll need to execute the following code
Dim numRecords
rst.movelast
numRecords = rst.recordcount
rst.MoveFirst
Keep in mind that moving to the last record in large recordsets can be slow. So use this sparingly.
We have a function, GetRecordCount, shown below that we use whenever we need to get the recordcount of a recordset.
'------
Public Function GetRecordCount(pasRst As DAO.Recordset) As Long
'* Cursors: adOpenKeyset & adOpenDynamic
On Error GoTo Err_Proc
If pasRst.BOF = True And pasRst.EOF = True Then
GetRecordCount = 0
Else
pasRst.MoveLast
GetRecordCount = pasRst.RecordCount
pasRst.MoveFirst
End If
Exit Function
Err_Proc:
msgbox Error
Exit Function
End Function
----------------
Please note this is for a DAO recordset. You could also do one for ADO recordsets.
If you have any questions, please let me know.