Returning query results to VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to return the results of a query to VBA?

I have a very simple query to count the number of records in a table and I
want to use the result in an If...Then statement in VBA

Can it be done and if so how?

Thanks

Simon
 
Simon,

One approach is to use a domain aggregate function within your VBA code
to reference the value. You could use a DLookup() function to return
the count value from your query, or you could dispense with the query
and use a DCount() function to retrieve the count directly from the raw
data.
 
Thanks Steve - DCount was just what i needed

Steve Schapel said:
Simon,

One approach is to use a domain aggregate function within your VBA code
to reference the value. You could use a DLookup() function to return
the count value from your query, or you could dispense with the query
and use a DCount() function to retrieve the count directly from the raw
data.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top