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

Calculations, different reports

Status
Not open for further replies.

cmmd2003

Programmer
Mar 23, 2007
28
GB
I have calculations in a report to work out payments deducting tax for some unless tax deduction flag is given using the statement


=IIf([TaxDeductionFlag]=True,([Text24]),([Text24]-(([Text24]/100)*22)))

This value is being stored in a text box, "Text30"


I am now creating another report, to show the total payments used, from the values of Text30.

How can i use the values in Text30 to comeup with an overall value for all of them?
 
There is a lot of ways to do this, but I find it a lot easier if I am using calculated values on multiple reports to do the calculations in the query not the report. Then use the query as the reports recordsource.

I assume that [text24] has a control source of a field, I will call that field "payment". I build a calculated field in a query (queryPayment) instead of on the report. In the query builder I build a calculated field called "calcPayment":
calcPayment: IIf([taxDeductionFlag],[payment],[payment]-[payment]/100*22)

Now on your original report text30 would have a control source of "calcPayment"

Now you can use the original query with the calculated field on another report using grouping as necessary or summing the "calcPayment" field.

So queryPayment could look like this and be the recordsource for the first report:

SELECT tblTaxDeduction.taxDeductionFlag, tblTaxDeduction.payment, IIf([taxDeductionFlag],[payment],[payment]-[payment]/100*22) AS calcPayment
FROM tblTaxDeduction;

And queryTotalPayment could look something like and be the recordsource for the second report:
SELECT Sum(queryPayment.calcPayment) AS SumOfcalcPayment
FROM queryPayment;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top