Repeat macro until record count of query = 0

Discussion in 'Microsoft Access Macros' started by JanS, Aug 8, 2012.

  1. JanS

    JanS

    Joined:
    Jul 30, 2012
    Likes Received:
    0
    Greetings,

    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.

    :fool:

    Jan
     
    JanS, Aug 8, 2012
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. steve downs

    Repeat query until no records returned

    steve downs, Apr 23, 2004, in forum: Microsoft Access Macros
    Replies:
    0
    Views:
    323
    steve downs
    Apr 23, 2004
  2. Bertie

    Run Macro Repeat Count

    Bertie, Jun 24, 2004, in forum: Microsoft Access Macros
    Replies:
    1
    Views:
    557
    Steve Schapel
    Jun 25, 2004
  3. Ann

    Do ...Loop Until macro help

    Ann, Aug 12, 2004, in forum: Microsoft Access Macros
    Replies:
    1
    Views:
    738
    Steve Schapel
    Aug 13, 2004
  4. Dave R.
    Replies:
    1
    Views:
    766
    Brendan Reynolds
    Jun 24, 2005
  5. Tom K via AccessMonster.com

    Find Record action to display a record that is the current record on another for

    Tom K via AccessMonster.com, Oct 31, 2005, in forum: Microsoft Access Macros
    Replies:
    0
    Views:
    918
    Tom K via AccessMonster.com
    Oct 31, 2005
  6. Guest

    Get Repeat Count from unbound control in Form

    Guest, Feb 3, 2006, in forum: Microsoft Access Macros
    Replies:
    3
    Views:
    543
    Guest
    Feb 6, 2006
  7. Guest

    Query count previous record

    Guest, Nov 2, 2007, in forum: Microsoft Access Macros
    Replies:
    2
    Views:
    233
    Guest
    Nov 6, 2007
  8. sdg8481
    Replies:
    0
    Views:
    717
    sdg8481
    Aug 5, 2008
Loading...