Query result in VBA

Magster

Registered User.
Local time
Today, 09:14
Joined
Jul 30, 2008
Messages
115
Hi all,

I have a query which provides a count of the rows meeting my criteria. I want to call this query from VBA and capture the count. I know that I can create a recordset using this query and check the recordcount of the recordset. But...

What I'd like to know is there a quick way to get the query's result directly into a variable without creating a recordset since I'm not interested in the recordset itself? If so, would you provide the syntax of the call to the query in VBA?

Thanks so much!

M
 
Can you use the dcount() function for this?
 
Hi Ken - and thanks for the quick reply. I never heard of this function, but from what I see on the help documentation, I think it will work perfectly! Thanks very much and have a great day!
 
I spoke too soon - my query has a parameter and the domain of the dCount method states that no parameter queries are allowed. So I guess I'm back to the recordcount method of the recordset.

Thanks Ken for the suggestion. I'm sure that I'll make use of this function in the futuer!
 

Users who are viewing this thread

Back
Top Bottom