How to check the recordcount

radek225

Registered User.
Local time
Today, 02:22
Joined
Apr 4, 2013
Messages
307
1) If I check recordcount without move rst to last position I get wrong number of recordcount.

Code:
rst = CurrentDb.OpenRecordset(strSQL)
msgbox nz(rst.RecordCount, 0)

2) If I move rst to last position, number of recordcount is correct, but! If there's no record in my string I get an error that rst can't move to last position:/

Code:
rst = CurrentDb.OpenRecordset(strSQL)
rst.MoveLast
msgbox nz(rst.RecordCount, 0)

So the question is, how to check correctly RecordCount even if my query in string has no record?
It's about DAO.Recordset
 
Thx, your link solved my problem.
 

Users who are viewing this thread

Back
Top Bottom