robercr12,
Yes to the first, the second... I have never worked with and can't say for certain.
The key to summarizing between Subreports, Multiple-Subreports and Main Report is declaring variables of "Shared" type, if you miss the declaration, they can only be used within the report they exist (whether a subreport or a main).
An example declaration (using the Balance x Rate scenario above) is simply:
{@VariableRESET_TotalBalance}
Code:
WhilePrintingRecords;
Shared NumberVar TotalBal:=0;
Carrying this example to a subreport, the accumulation of Balance would look something like:
{@VariableSET_TotalBal}
Code:
WhilePrintingRecords;
Shared NumberVar TotalBal:= TotalBal+{BalanceField};
To display the total balance after all subreports/accumulation would be:
{@VariableDISPLAY_TotalBal}
Code:
WhilePrintingRecords;
Shared NumberVar TotalBal;
Note: you can do all of your resets and/or variable setting in one formula if you wish, I personally opt to keep them separate. From my formula field names, I am sure you can surmise my reasoning for doing so - I had a report with over 100 over these types of variables, and having the variable name I was working with in the formula name was very handy when tracking that many variables.
To be honest, I never know when to include or not include the "whileprintingrecords;" line... but I always have it in there and it has worked for my uses. I know there are other functions (WhileReadingRecords, for example) and I am not too sure the difference between them and also know you can leave the clause out entirely.
Hope this helps! Cheers!
Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."