Calculate the percentage of records in a group in Access

Contributor Icon Contributed by Lilliabeth Date Icon August 8, 2004  
Tag Icon Tagged: Microsoft Office


Although it’s easy to count the number of records in a group, determining that number’s percentage of the report’s overall record count may not seem easy to do. Fortunately, it’s easy to calculate the percentage. First, add a textbox control to the report’s Detail section and name it txtCountAll. Then, set its Visible property to No and set its Control Source property to:

=Count(*)

Then, add a textbox control the group footer. Name the new control txtCountGroup and set its Visible property to No. As before, set its Control Source property to:

=Count(*)

Next, add another textbox to the group footer and set its Control Source property to:

=txtCountGroup/txtCountAll

Finally, set the new textbox control’s Format property to Percent.

Previous recipe | Next recipe |
 

 
close Reblog this comment
blog comments powered by Disqus