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 data from form calculations for report

Status
Not open for further replies.

Swiftraven

Technical User
Oct 29, 2001
28
US
Hi all,
I have reports that I can not get to perform the calculations that I need (I asked about them in other threads). Is there a way for me to use the calculated data on the form and place it in the report instead of trying to redo the calculations on the report? And if so, how can I loop through all the records in the recordset that need the calculations performed on the form and get them placed in the report?

Thanks
Jason
 
Hi Jason!

I can help you with this if you would like. I cannot see why you are unable to do the calculations in the report, but yes, you CAN pull the information from a form. In the specific field, type in: "=Forms!NameOfForm!NameOfField" without the quotes.

Any field you use inside the report that is used to calculate MUST be unbound. The calculation would go in the Control Source of the Data tab precluded with an equal sign.

Let me know if you have any other issues.
Roy
aka BanditWk
Las Vegas, NV
roy@cccamerica.org
RLMBandit@aol.com (private)
 
Thanks Roy.
I assumed I could do what you said, but how would I loop through all the records that the form and report are based on (they are based on the same recordset) and get the calculated values from the form to the report for each one?

I may just be not understanding exactly how reports work.

Thanks
Jason
 
For each record, you will need to do the calculations in the underlying query instead.

For instance, query has the following fields:

ClientID Name HrsWorked HrlyRate OT

What you would need to do is add another field after OT for your record calculation that will look something like this:

Expr1: [HrsWorked]*[HrlyRate]+([OT]*[HrlyRate]*1.5)

You can rename "Expr1" to "TotalPay" to name the column appropriately and allow you to refer to it appropriately in the Report.

HTH Roy
aka BanditWk
Las Vegas, NV
roy@cccamerica.org
RLMBandit@aol.com (private)
 
Roy,
What if the part of the data needed to complete the calculations needs to come from another query (I need to get values above and below another calculated value, interpolate them, and use the results in the other calculations). I tried referencing another query in the calculation expression in the query but get an error every time.

Thanks
Jason
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top