Information générale
Titre:
Refreshing RECORDSETS / RecordCount
Hello all ..
I'm sure this is common knowledge, but I would like to clarify this!
Maybe there is a service pack that will fix this? Otherwise, help me find
the optimal way to open a recordset, and count the records!
When I open a recordset as such :
strSql = "SELECT * from tblParts WHERE Run_Number = '" & RunNumber & "'"
Set rsData = mdbData.OpenRecordset(strSql, dbOpenDynaset)
Sometimes I want to do a RecordCount right away. I have learned that RecordCount will not work properly unless this is done first :
rsData.MoveLast
rsData.MoveFirst
So that VBA will know how many records are in it (and it will position the pointer back to the top).
THIS WORKS GREAT, except when the recordset I open HAS NO RECORDS, then doing a movelast/movefirst crashes it. Ugh!
What shall I do!??!?!
Signed,
Data-Schmoozer-Joe
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement