Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Refreshing RECORDSETS / RecordCount
Message
De
17/08/2001 14:29:54
 
 
À
Tous
Information générale
Forum:
Visual Basic
Catégorie:
VBA
Titre:
Refreshing RECORDSETS / RecordCount
Divers
Thread ID:
00545560
Message ID:
00545560
Vues:
49
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
Fil
Voir

Click here to load this message in the networking platform