These lines:
.... are not necessary in a freshly opened recordset.
To loop through the recordset:
With QryDat
Do Until .EOF
' ... work with current row here ...
' Move to next row.
.MoveNext
Loop
' Display record count, if you want.
MsgBox "Finished processing " & .RecordCount & " records."
.Close ' Close recordset when done with it.
End With
To find out how many records were returned, you have to first move to the
last record. Note that the loop above displays the record count after
looping through all the records. If you want to know right after opening
the recordset, you have to move to the last record first:
Set QryDat = Mydb.OpenRecordset("SELECT * FROM qryBasketContent;")
With QryDat
If Not .EOF Then
.MoveLast ' Go to the end to get record count
.MoveFirst ' Go back to first record, if you want
End If
MsgBox "Finished processing " & .RecordCount & " records."
' ... other code to work with recordset goes here ...
.Close ' Close recordset when done with it.
End With
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)