Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Refreshing RECORDSETS / RecordCount
Message
From
17/08/2001 14:29:54
 
 
To
All
General information
Forum:
Visual Basic
Category:
VBA
Title:
Refreshing RECORDSETS / RecordCount
Miscellaneous
Thread ID:
00545560
Message ID:
00545560
Views:
46
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
Next
Reply
Map
View

Click here to load this message in the networking platform