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!

sum a total where condition... 1

Status
Not open for further replies.

adsfx

Programmer
Jun 4, 2003
237
GB
Hi,
I have a report that displays all records in a table.
the report is populated by an underlying query.
I have textboxes that sum ALL the totals, but I need to know how to sum totals on condition of a field in a table.

Is this best done as an expression in a textbox?:
=IIf([cattype_id]=2,Sum([amount]))

or would you suggest an alternative?
 
Your thinking in the right direction but you may need to modify your expression something like this

=Sum(IIf([cattype_id] = 2, [Amount],0))

This should give you what you are looking for.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top