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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting multiple fields in query 1

Status
Not open for further replies.

Howard1024

Technical User
Oct 10, 2003
8
US
I have a program that logs OSHA safety report info. I have a query that pulls all records that have an 'OSHA 300#'. I need to count the number of 'yes' records for 5 fields in this query and sum 2 other fields.

This query is the source for a report that prints each selected record and then totals the columns in the page footer.

Suggestions.....please!
 
Try
Code:
   Select Sum(IIF(fld="Yes",1,0)) As [Yes Count],
          Sum (Fld2) As fld2Sum,
          Sum (Fld3) As fld3Sum, ...
 
I believe you are attempting to count and sum in the report footer only. To count yes values in Field1, use:
=Abs ( Sum(Field1) )
To count No values
=Sum(Field1+1)
To sum any other field
=Sum([AnyOtherField])


Duane
MS Access MVP
 
I appreciate both responses. I do not know how to show the results in the report. I know how to assign a source from a table or query but not how to calculate a value and then show it.

Howard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top