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
    Messages:
    3
    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?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. steve downs

    Repeat query until no records returned

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

    Run Macro Repeat Count

    Bertie, Jun 24, 2004, in forum: Microsoft Access Macros
    Replies:
    1
    Views:
    255
    Steve Schapel
    Jun 25, 2004
  3. Dave R.
    Replies:
    1
    Views:
    478
    Brendan Reynolds
    Jun 24, 2005
  4. Guest

    Get Repeat Count from unbound control in Form

    Guest, Feb 3, 2006, in forum: Microsoft Access Macros
    Replies:
    3
    Views:
    405
    Guest
    Feb 6, 2006
  5. sdg8481
    Replies:
    0
    Views:
    580
    sdg8481
    Aug 5, 2008
Loading...

Share This Page