Repeat macro until record count of query = 0

Jul 30, 2012
Reaction score

I have a macro that needs to run repeatedly until the number of records in a query =0 but I can't seem to get the Repeat Expression set properly.

My query is called sqMatchCount:
SELECT Count(sqCompare_Parts_Matched_1st.BRP_Entry_Num) AS MatchCount
FROM sqCompare_Parts_Matched_1st;

The theory is if I don't have any more matches then I do not want the macro to run any more. In other words, MatchCount will = 0 when there are no more matches.

I have tried a variety of syntax using DCount in the Repeat Expression:

=DCount("*","sqMatchCount") = Macro runs in a continuous loop
DCount("*","sqMatchCount")=0 = Macro does not run (although I thought a couple times it actually DID run with this syntax)
DCount("MatchCount","sqMatchCount")=0 = Macro does not run
=DCount("MatchCount","sqMatchCount")=0 = Macro does not run
=DCount("MatchCount","sqMatchCount") = Macro runs in a continuous loop

What IS the proper way to write this Repeat Expression for the RunMacro Action if I want it to run as long as sqMatchCount.MatchCount>0?

Thanks in advance for any help you can give me.



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

Similar Threads