Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Sydney, Australia, New South Wales, Australia
    Thanked 4 Times in 4 Posts

    Count report groups (2000 SR1)

    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

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Melbourne, Australia
    Thanked 32 Times in 32 Posts

    Re: Count report groups (2000 SR1)

    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.

    Pat <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Count report groups (2000 SR1)

    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts