Data can be passed between main and sub reports using shared variables.
In your case create a formula in your sub report that sets a shared variable to the value you want to pass to the main report:
// {MySharedVariable}
WhilePrintingRecords;
Shared StringVar MyShrVar;
MyShrVar:= (calculation or database field)
In the main report create a formula that declares the same shared variable, but do not assign a value. Place the formula in the main report in a section below the section containing the subreport:
// {MySharedVariable}
WhilePrintingRecords;
Shared StringVar MyShrVar;
Also, be sure to create a formula in the report header of the subreport that resets the shared variable back to zero or blank or null:
// {MySharedVariableReset}
WhilePrintingRecords;
Shared StringVar MyShrVar:= ""
The formula declaring the shared variable in the main report will contain the value set in the subreport and is available for display, calculations, etc.
MrBill