Can I Execute a query and capture result?

j0se

Registered User.
Local time
Today, 16:17
Joined
Jan 15, 2003
Messages
57
I have a stored query in my db. The query gets the recordcount of all the items in a table.

In my VBA, rather than code a new db conection, set a recordset etc, I want to execute the query using DoCmd

=======
DoCmd.OpenQuery stDocName, acNormal, acEdit
=======

The above line displays the results of the query.

What I really want is to run the query and store the recordCount in a variable - without displaying the results.

Can this be done?

Thanks all
 
Use DLOOKUP instead of docmd
MyVar = DLOOKUP("columnName","queryname","OptionalCriteria")
 
cool

thanks for that!!!
 

Users who are viewing this thread

Back
Top Bottom