How do I check the query record count from a macro?

R

Robert_L_Ross

I have a macro that needs to do one thing if the number of records in a query
is >0, and something different if the number of records in the same query is
0. How do I tell the macro to check the record count of the query?
 
K

Ken Snell [MVP]

Use the DCount function in the Condition expression. See DCount info in Help
files.
 
R

Robert_L_Ross

1 - there is no help file from Access directly (without going into the
expression builder) on DCount
2 - that is a solution using VB - I need this to happen from a Macro - the
condition line to be exact - "How do I tell the MACRO to check the record
count of the query?" - we don't want to do this using VB
 
K

Ken Snell [MVP]

DCount information can be found in VBA Help under function list.

You can use VBA functions in macro conditions. The following will be true if
there is at least one record found:

Condition:
DCount("*", "TableOrQueryName", "[FieldName]=SomeValue") > 0
 

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

Top