PC Review

Thread Tools Rate Thread

Repeat macro until record count of query = 0

New Member
Join Date: Jul 2012
Posts: 3
      8th Aug 2012

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.

Reply With Quote

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Repeat a macro until the last line is empty or repeat it 1400 time marita Microsoft Excel Programming 3 18th Jul 2008 01:40 PM
count uniques in same column, post in blank cell, repeat until end ofspreadsheet S Himmelrich Microsoft Excel Programming 2 15th Jan 2008 08:31 PM
Need Help Making a Macro Repeat Until All Rows Are Processed jessiright77@gmail.com Microsoft Excel Programming 4 3rd Dec 2006 01:15 PM
Repeat Macro until Empty Cell Reached =?Utf-8?B?Y2xwbmNzZw==?= Microsoft Excel Programming 19 1st Oct 2005 02:14 AM
Repeat macro until end of document =?Utf-8?B?Q2hyaXNAUERY?= Microsoft Word Document Management 1 7th Jul 2005 03:57 AM




All times are GMT +1. The time now is 10:12 AM.