pdvsa
asked on
Summing in a Report
Experts,
I need to sum tblPayments.Amount in the below. How can I do this? I have tried to put the word SUM in many places.
This is a field in a report.
I can not drag in tblPayments to the query so I need the Dlookup.
=IIf([PaidInFullYN]=True," Paid In Full",Format(Nz(DLookUp("[ Amount]"," tblPayment s","[LCID] = " & [LetterOfCreditID]),0),"Cu rrency"))
I need to sum tblPayments.Amount in the below. How can I do this? I have tried to put the word SUM in many places.
This is a field in a report.
I can not drag in tblPayments to the query so I need the Dlookup.
=IIf([PaidInFullYN]=True,"
ASKER
Hi Dale,
I actually didnt need the Dlookup after using the Dsum as you state above. I got confused on Dlookup.
I need to add a condition to the false part.
Currently, the Dsum sums all of the records for "Amount","tblPayments","[LCID] = " & [LetterOfCreditID])) but I need for the Dsum to only sum for the below condition on another checkbox called PAIDYN (see bold below):
the condition:
If Dlookup PAIDYN = True then sum those records on "Amount","tblPayments","[LCID] = " & [LetterOfCreditID])
SumPayments: IIf([PaidInFullYN]=True,"Paid In Full",DSum("Amount","tblPayments","[LCID] = " & [LetterOfCreditID]))
I dont think I can use SUM in the query design window because I get an error when I change Dsum to Sum. Also, tblPayments is not in the query and I cant drag it in because it messes up the record count so I might need to use dlookup. (i dont know).
I actually didnt need the Dlookup after using the Dsum as you state above. I got confused on Dlookup.
I need to add a condition to the false part.
Currently, the Dsum sums all of the records for "Amount","tblPayments","[LCID] = " & [LetterOfCreditID])) but I need for the Dsum to only sum for the below condition on another checkbox called PAIDYN (see bold below):
the condition:
If Dlookup PAIDYN = True then sum those records on "Amount","tblPayments","[LCID] = " & [LetterOfCreditID])
SumPayments: IIf([PaidInFullYN]=True,"Paid In Full",DSum("Amount","tblPayments","[LCID] = " & [LetterOfCreditID]))
I dont think I can use SUM in the query design window because I get an error when I change Dsum to Sum. Also, tblPayments is not in the query and I cant drag it in because it messes up the record count so I might need to use dlookup. (i dont know).
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Crystal, (typing from phone) thank you for the comment. I actually did exactly what you said and it does work. I did not add that query to the recorsource but i instead used Dsum on the report. I ran into another problem in that access wont allow to sum this field on the report footer. Its like I solve one problem but then have another.
Do you have a work around suggestion?
Do you have a work around suggestion?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
But instead of DLOOKUP, why don't you use DSUM("Amount", "tblPayments", "[LCID] = " & [LetterOfCreditID]).
I think you could probably get rid of the NZ in there as well.