Calulcating percent change from first record

T

Tony Vrolyk

I have a columnar report and I am looking for a way to display the percent
difference of each record in comparson to the first. The field I am
comparing is a calculatated control on the report so running it as a query
first is not possible.

I was thinking of setting one of two variables to match the first record but
that variable would not be changed for the rest of the report. Then a second
variable that would be set to match the same field on subsequent records and
then calculate the percent difference and assign that value to a text box.

I am guessing this would be done on the print event of the detail section
but not sure how to do it exactly. I should mention that this is happening
on a subreport but there is no data in the parent report that relates
directly to the calulation question.

Thanks for your help
Tony
 
M

Marshall Barton

Tony said:
I have a columnar report and I am looking for a way to display the percent
difference of each record in comparson to the first. The field I am
comparing is a calculatated control on the report so running it as a query
first is not possible.

I was thinking of setting one of two variables to match the first record but
that variable would not be changed for the rest of the report. Then a second
variable that would be set to match the same field on subsequent records and
then calculate the percent difference and assign that value to a text box.

I am guessing this would be done on the print event of the detail section
but not sure how to do it exactly. I should mention that this is happening
on a subreport but there is no data in the parent report that relates
directly to the calulation question.

I don't think it's that complicated. The report header
section can refer to fields in the first detail detail. Add
a text box to the report header and set it's control source
to the same field or expression that you used in the detail
section.

Then the percentage text box in the detail section can refer
to the text box in the header section and the calculated
textbox in the detail section.
 
T

Tony Vrolyk

That sounds good. I will give it a try.


Marshall Barton said:
I don't think it's that complicated. The report header
section can refer to fields in the first detail detail. Add
a text box to the report header and set it's control source
to the same field or expression that you used in the detail
section.

Then the percentage text box in the detail section can refer
to the text box in the header section and the calculated
textbox in the detail section.
 
T

Tony Vrolyk

It worked! thanks


Marshall Barton said:
I don't think it's that complicated. The report header
section can refer to fields in the first detail detail. Add
a text box to the report header and set it's control source
to the same field or expression that you used in the detail
section.

Then the percentage text box in the detail section can refer
to the text box in the header section and the calculated
textbox in the detail section.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top