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.
 
Back
Top