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

Using DSUM Based on Multiple Criteria

Status
Not open for further replies.

IJOC

Technical User
Jan 27, 2009
24
US
I am trying to sum based on multiple criteria.

I want to be able to have a calculated sum in one field that can automatically calculate the dollar amount of all records in a transaction that the ysnSP field = "YES".

So I created a field in my report and added this below. However it did not display anything when running the report.

=DSum("currBV * intOutCardQty","qrptTransactionsOut","ysnSP = yes" & [pkTransID]=[pkTransID])

Any help would be great!
Thanks
-Pat
 
how about
Code:
=DSum("currBV * intOutCardQty","qrptTransactionsOut","ysnSP = yes and  [pkTransID]=" & [pkTransID])
 
That did it. All too simple. Thanks again
 
If you are summing values from records in the report's record source, you should probably not use DSum() since it slows down your report. If your reports record source is qrptTransactionsOut and the text box is in a header or footer section of pkTransID and ysnSP is a yes/no field then try:
Code:
  =Sum(Abs(ysnSP) * currBV * intOutCardQty)

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top