General information
Title:
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
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only