Merlin,
If by "work correctly you mean that you can get an accurate record count, then yes as Disco stated. In Access 97, the RecordCount property will be either 0 or 1 after first creating the recordset. 0 is empty and 1 is 1 record or more. If you MoveLast / MoveFirst access then reads through all records and sets RecordCount = the actual number of records in the recordset and returns to the first record.
My customers table has 5 customers in the state of PA ...
Ex 1
Dim R as Recordset, SQLTxt
SQLText = "Select * From Customers Where State = 'PA';"
Set R = CurrentDB.OpenRecordset(SQLTxt)
MsgBox "Records = " & R.RecordCount
Result --> Records = 1 (even though there are 5 records)
EX 2
Dim R as Recordset, SQLTxt
SQLText = "Select * From Customers Where State = 'PA';"
Set R = CurrentDB.OpenRecordset(SQLTxt)
R.MoveLast
R.MoveFirst
MsgBox "Records = " & R.RecordCount
Result --> Records = 5
Also MoveLast will generate an error message if the recordset is empty so its a good idea to test for an empty record set before attempting to moveLast.
...
If R.RecordCount Then
Set R = CurrentDB.OpenRecordset(SQLTxt)
R.MoveLast
R.MoveFirst
Else
MsgBox " There are no matching records"
End IF
Alley, what version of Access ? Im curious.
Dave