Thread: Return RecordCount After Search
07-06-03, 08:30 #1Registered User
- Join Date
- May 2003
Unanswered: Return RecordCount After Search
I want to check the record count of a returned by a Query, with VBA, so that. I can set up a structure basically like this
If SuccessfulSearch = False,
Basically using the first 3 charators of the searched for part number and running a like query. My problem is, its a fairly big database, on a fairly slow computer. So finally my Question.
How can I get VBA to wait for the Query to finish, before checking the RecordCount property.
thanks much BB.K did you Flashy thing me, K??
07-06-03, 08:57 #2Cavalier King Charles
- Join Date
- Dec 2002
- Préverenges, Switzerland
you have a couple of choices which involve trawling through your (big, slow) database twice: DCOUNT domain aggregate function and COUNT in SQL.
other solution is to take your query results into a recordset and do a .movelast:
dim dabs as dao.database dim rex as dao.recordset dim accurateRecordCount as long set dabs = currentdb set recs = dabs.openrecordset(nameOfYourQuery) rex.movefirst 'not strictly necessary, just one of my bad habits. rex.movelast 'this fully populates the recordset accurateRecordCount = rex.recordcount