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

Multiple references to a subreport in a main report 2

Status
Not open for further replies.

wilbur00

Programmer
Dec 9, 2004
16
US
Hello -

I'm using Crystal 8 and Access 97 and want to reference the results of a subreport multiple times in my main report. What is the best way to do that?

Thank You!
 
A little more technical information would be extremely helpful.

In general the placement of the subreport in the main report will determine the amount of interaction. In short, Report header/Footer only executes once per report whereas a subreport at the group level will execute whenever there is a group change until finally at the detail section, where it will fire for each detail record found on the main report.

-LW
 
Thank you for your response. My report is using 2 tables:
Employee
Calls Made / Employee

I have a group that calculates the number of calls made per employee (grouping and counting the call records by employee). I also display the single value of the call goal per employee (from the employee table). At the bottom I need to display the totals. I can't use the group total to sum the goals (because it duplicates the goal for each grouped call record). So I inserted a subreport to just do a sum of the goals in the employee table. Now I need to use the sum of the goals in other calculations on the report footer.

I've created a formula in the subreport and a formula in the main report using a shared variable, but it has a value of 0. I tried putting the main report formula in a section above AND below the subreport and it still has a value of zero.

I appreciate your help with this. It doesn't seem like it would be difficult, but 3 of us have tried to figure it out and can't.

Thank you!
 
Zeroes at both ends indicates one of the following
[ol]
[li]Have you verified your employee link to the subreport employee link?[/li]
[li]Shared variable names are not the same between the main report and subreport.[/li]
[li]Make sure subreport or the section it resides is not suppressed. You can hide the contents of the subreport but do not suppress it.[/li][/ol]

Might want to post all affected formulas to see what's going on.

 
Hello again...

Here is the format of my report:
Report header
Page header (suppressed)
Group header (suppressed)
Group details (by employee, summarizing calls) (suppressed)
Group footer (shows sum of calls and goal for each employee)
Report footer (total calls for all employees, includes the subreport to read the employee table and sum employee goals - just reads all records and does a sum of the goal field - has the details suppressed with the report footer displaying the goal total I need)
Page footer (suppressed)

The main report footer also has a bunch of other calculations where I need to use the goal total.

For the shared variable, here's what I have:
----Main Report.TotalMigrGoalMain----
WhilePrintingRecords;
Shared NumberVar MigrGoalTotal;
MigrGoalTotal

----SubReport.TotalMigrGoalSub----
WhilePrintingRecords;
Shared NumberVar MigrGoalTotal:= Sum ({USysEmployees_Table2.MigrGoal})

I have the name of the formulas different with the variable names the same. The subreport which sets that variable is run in the report footer. In the main report I displayed the MigrGoalTotal formula in the report header (not suppressed), in the report footer, and in the page footer and they all show zero. I've unsuppressed the page footer to test the value of the variable.

I do appreciate your help with this. It has me totally stumped. Thank you!
 
Two things: The subreport MUST be in a main report section above the one in which the shared variable is referenced. Insert a second report footer section, if the subreport is located there. In the subreport, be sure to place the shared variable formula somewhere on the subreport canvas, even if suppressed.

-LB
 
Thank you so much! I created a second report footer and placed the formula on my subreport and it worked. Thank you! Thank you! Thank you! Now off to show the user their report...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top