Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Getting simple percentages in reports and queries


Message #1 by simonds@m... on Thu, 17 Jan 2002 21:08:59
I have a report that's source is a query. The query simply counts the 

number of males and females in the table. The SQL is:



SELECT Primary.Gender, Count(Primary.Gender) AS [Number For Each Gender]

FROM [Primary]

GROUP BY Primary.Gender;



What I really want is the percentages of each, hence the report. In the 

report I feed from the query the [Number For Each Gender] result, and have 

an unbound text box beside it that is an unbound control with the formula 

=ROUND([Number For Each Gender]/Sum([qryGenderPercentage]![Number For Each 

Gender])*100,2) to get the Percentage for each sex.



Question #1: Is there an easier to get the percentage?



Question #2: How can I get the total number, i.e., the sum of the two 

counts to appear below the two numbers. I've tried various configurations 

of grpu header/footers and the page footer gives me an error. I tried 

another query (like the one above but without the GROUP BY) to get the 

number and then referring to it in an expression builder but that didn't 

work. I also used Sum([qryGenderPercentage]![Number For Each Gender]) 

which was good because I didn't need to create another query, but in the 

footers I always get it twice, below each gender sort, or an error in the 

page footer.



Thanks for any assistance.



Regards,

Eric


  Return to Index