Calculations between a report and its subreport

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a report (based on a query) that contains a subreport (based
on another query) and I need help performing calculations using both the
report data and subreport data. Specifically I am trying to take order
quantities from the subreport, total them for each item, and subtract that
amount from the quantity for each item of the same description in the main
report.
Any help would be greatly appreciated.
Thank you.
 
JCL said:
I have created a report (based on a query) that contains a subreport (based
on another query) and I need help performing calculations using both the
report data and subreport data. Specifically I am trying to take order
quantities from the subreport, total them for each item, and subtract that
amount from the quantity for each item of the same description in the main
report.


Calculate the subreport totals in the subrepor. E.g. a text
box with =Sum(Qty) in the subreport's footer section.

Then the main report can retrieve that total in a main
report text box with an expression like:

=subreport.REPORT.textbox

or, if there's a chance the subreport might not have any
records:

=IIf(subreport.REPORT.HasData, subreport.REPORT,textbox, 0)
 
Thank you.
I am able to pull data from the subreport with one problem. When there are
more than one subreport item for a report item, I only get the quantity for
the first matching subreport item and not the others.
 
I don't understand. What's a "matching subreport item"?

Maybe the issue is that where I wrote "subreport" you were
supposed to replace it with the name of the subreport
CONTROL, not the name of the report object displayed in the
control. These two names are sometimes the same, but there
is no need for them to be. Technically, the report object's
name is specified in the subreport control's SourceObject
property, while you need to use the Name property.
 
Thanks for your help. You put me in the right direction with your first
responce. After I replied to you the first time, I found out how to make my
report work. I created another query that would subtotal the items in my
subreport and then used that query as another subreport in my original
report. I was then able to pull from that subreport the data I needed.
Thank you again.

Marshall Barton said:
I don't understand. What's a "matching subreport item"?

Maybe the issue is that where I wrote "subreport" you were
supposed to replace it with the name of the subreport
CONTROL, not the name of the report object displayed in the
control. These two names are sometimes the same, but there
is no need for them to be. Technically, the report object's
name is specified in the subreport control's SourceObject
property, while you need to use the Name property.
--
Marsh
MVP [MS Access]


I am able to pull data from the subreport with one problem. When there are
more than one subreport item for a report item, I only get the quantity for
the first matching subreport item and not the others.
 
Back
Top