Returning query results to VBA

S

Simon Cleal

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
 
S

Steve Schapel

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.
 
S

Simon Cleal

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