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

using Subreport Values in another Subreport

Status
Not open for further replies.

fbicfc

Technical User
Nov 13, 2002
35
GB
Hi,

This problem is doing my head in as I don't think it should be a problem!!!!

I have a report made up of 3 Subreports:

Subreport 1 reports a set of figures and an unbound text box has a calculation in it to subtract one value from another, this all works fine

Subreport 2 reports a set of figures and an unbound text box has a calculation in it to add one value to another, again this all works fine

Subreport 3 has 3 unbound textboxes - these text boxes are for containing the figures from the calculation in Subreport 1 and the calculation in Subreport 2, both of these values are then subtracted to give a value.

The problem is that the texboxes to display the values in Subreport 3 do not display the values taken from Subreports 1 & 2.

This is an example of how I am trying to get the values into the textboxes in Subreport 3:

=[Reports]![FB_Repairs]![FB_Repairs2Column].[Report]![Total]

Can anyone throw any light on this, am I doing something stupid or impossible!

TIA

FBICFC
 
An easy solution is to first define a module that has two public variables it:
Public dblTotal1 as double
Public dblTotal2 as double

In your subreports 1 and 2, be sure that in addition to setting the value of the control to the total value you also set the value of the appropriate public variable listed above to the same value.

Then your third report can easily calculate the total by adding the values of the public variables.

 
Hi,

Thanks for the response, unfortunately I don't think it can work with the way the information is used.

I should have mentioned that the sub-reports all have a grouped header because the figures that are displayed are grouped by area. eg:

REPORT 1

Area Total

Area 1 3
Area 2 4
Area 3 2

REPORT 2

Area Total

Area 1 2
Area 2 3
Area 3 1

REPORT 3

Area Total

Area 1 Report1 total - Report2 total
Area 2 Report1 total - Report2 total
Area 3 Report1 total - Report2 total

So I need to subtract the total figures from 2 sub-reports into a 3rd sub-report.

Because I have a header on the total figure that is placed in the module is not the correct value.

Hope this makes sense, it all seems to be straight forward but I just can't get my head round it.

Any further help would be appreciated.

FBICFC
 
I would calculate all values directly in the third subreport. It seems to me that if you can calculate the values in subreport1 and subreport2 that you should be able to calculate similar values in subreport3 without relying on pulling values from the other two subreports.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Just define as many public variables in the module as you need and in each subreport set each appropriate public variable to the appropriate value. When you are doing your main report you can perform any calculations you need using the values in the public variables defined in your module.
 
Hi,

Thanks for the suggestions but unfortunately none of them quite work with what I am trying to achieve or it is possibly (probably) my lack of knowledge with the reports system.

Anyway I have now handed this over :) to a couple of 'real' developers in the company and they can sort it out by use of withcraft or whatever it is they use.

Thanks for your suggestions.

FBICFC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top