• Count report groups (2000 SR1)

    Author
    Topic
    #383157

    I have an Access report with groups set. In the report footer I have a count of the number of detail bands with Count(*). Also in the footer I want a count of the group bands.
    I have played around with OnFormat and OnRetreat, but they don’t work correctly if the user doesn’t print all pages of the report.
    I could use a DCount, but the RecordSource is a complicated grouping link query. I don’t really want to keep that as a standalone query.
    Any ideas for an easy way to count groups?
    What about if there is multiple levels of groups?
    Thanks for your help
    Peter

    Viewing 0 reply threads
    Author
    Replies
    • #652501

      What you could do is setup a text control in one of the group footers (or headers) with the control source set to =1 and it’s running sum to Over All. In the format event save the value of this text control in a global integer variable. In the report footer move the value of the global variable into a text control that you have setup in the report footer.
      I guess it’s up to you how you would cater for multiple levels of groups.

      HTH
      Pat cheers

      • #652509

        You don’t even need a global variable. You can refer to the counter text box directly in a control in the report footer.

        Say that you place an invisible text box named txtGroupCounter in the group header or footer, with control source =1 and running sum set to Over All.
        Place a visible text box (named for instance txtCountOfGroups) in the report footer, with control source =[txtGroupCounter]. That’s all!

    Viewing 0 reply threads
    Reply To: Count report groups (2000 SR1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: