Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting based on Values

Status
Not open for further replies.

czarjosh

Technical User
Jul 14, 2002
79
US
How do I add a summary section to my report that counts based on value of a field.

I have a field in the report that has has 3 fixed values: Double, Triple, Quadruple.

What I want to do is have a summary that will count each one of these values types, but I want to expand the mathematical function.

If it is a double I want it to count the total number and divide by 2.

If it is a triple I want it to count the total number and divide by 3.

If it is a quadruple I want it to count the total number and divide by 4.

Can a summary secntion be added like this?
 
Could you type about 10 records into a response and then the total you would like to display?

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Name Room Type
-----------------------------------
Sally Mae Double
Joe Smith Double
Sarah Rae Double
Jim james Triple
Yumy Sakai Double
Taylor Mitch Triple
Harorld Ickes Triple
-----------------------------
Totals
Doubles 2
Triples 1
 
I would create a totals/group by query that grouped by RoomType and count RoomTYpe. Then create a subreport based on this query and place the subreport in the report footer of your existing report.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
ok, i have done that. Now in that query can i put a mathematical funtion into another field. Saying if grouped by this value divide by 3, or if grouped by this valued divide totals by 2?
 
Yes, you can use
Field: Count([RoomType])/3
Group By:Expression

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
though i do nto want ever total to return a dividend from the result of three.
i.e.
Total Outcome
Double 10 5
Triple 9 3

Can this be done.
 
Count([RoomType])/Switch([RoomType]="Double",2,[RoomType]="Triple",3,[RoomType]="Single",1,etc...)

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top