Home  |   French  |   About  |   Search  | mvps.org  

What's New
Table Of Contents
Credits
Netiquette
10 Commandments 
Bugs
Tables
Queries
Forms
Reports
Modules
APIs
Strings
Date/Time
General
Downloads
Resources
Search
Feedback
mvps.org

In Memoriam

Terms of Use


VB Petition

Reports: Count the Number of Groups on a Report

Author(s)
Steve Jorgensen

To count the number of groups on a report:

  1. Add a control to the header or footer of the group to be counted and name it something like txtGroupCount. Make the control invisible, set its control source to =1, and set its Running Sum property to Over All. This effectively generates a running count of the number of groups.
     
  2. In the report footer, add a control with a Control Source of =[txtGroupCount]. This displays the value of txtGroupCount as of the last group that occurs in the report at which time it is equal to the number of groups in the report.
     

  Note that the group count can only be displayed in the report footer (not the header) since that is the only point at which txtGroupCount contains a value equal to the total number of groups.

  This technique can be modified to show the number of groups within the group immediately surrounding the group to be counted by setting the Running Sum property of the first control to Over Group, and placing the second control in the surrounding group's footer instead of the report footer.


© 1998-2010, Dev Ashish & Arvin Meyer, All rights reserved. Optimized for Microsoft Internet Explorer