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!

Shared Variables and page breaks

Status
Not open for further replies.

janemaritz

Technical User
Nov 8, 2002
18
US
I am using shared variables to return a value from a subreport to a main vendor report. The main report uses a payment detail table with multiple records per vendor. The subreport uses a summary 1099 table with a single record per vendor. The main report displays one line per vendor (the group footer - the detail is suppressed) with a payment subtotal and the 1099 value from the subreport. Since I need to do a calculation on the 1099 value, I'm using a shared variable formula rather than displaying the subreport directly.

I've got the subreport and formulas set up so that the subreport values are showing up correctly, except for the occasional first record on a page. On the odd occasion, the first record shows the subreport value that was just used on the previous page for the previous vendor, and then the second record shows the correct vendor subreport value.

Has anyone else run into 'page break' issues with subreport shared variables?

FYI - Subreport formula (@1099Total) is
Shared NumberVar Total :=
(if isnull({@1099Dividend}) then 0 else {@1099Dividend})+
(if isnull({@1099Interest}) then 0 else {@1099Interest})+
(if isnull({@1099Misc}) then 0 else {@1099Misc})

The subreport is put in the main report group header and is not visible.

I then put the main report (@1099Total) formula in the group footer section b:
Shared NumberVar Total;

My (@Difference) calculation using the subreport value is in group footer section b as well:
{@1099Total} - Sum ({@PaymentsYTD}, {@VendorNumber})

Not sure if this is relevant, but I'm also using a formula (@Run1099Total) to get the report total. I put this formula in group footer section a (suppressed so it is not visible) and in the report footer.
NumberVar RunTotal;
Shared NumberVar Total;
RunTotal := RunTotal + Total;
RunTotal;

Let me know if you need additional info to clarify the problem.

Thanks!
 
I have run into this sometimes when initializing the shared variable and using it in the groupfooter. on some of my reports i tell the group to repeat on each page and if the group happens to repeat on the page then the variable iniliazes again and my numbers are off. So i now place the initialize formula after i display the variable in the footer. maybe it is because of the way your groups are displaying on the page breaks. look for a pattern where the page break is as to what line last printed; a detail line, group header group footer etc and then look for a pattern.

Sorry i can't be more specific. Mark
Email: markanas333@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top