How to check the recordcount

vendredi 3 avril 2015

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

How to check the recordcount

0 commentaires:

Enregistrer un commentaire

Labels