I found the solution on another forum.
- I used a shared variable to pass the amount paid from the subreport to the main report.
- Placed this formula in the higher group header: EvaluateAfter ({@shared});
numbervar sumx;
not inrepeatedgroupheader ;
sumx:=0; - Placed this formula in the same group footer as the shared variable: whileprintingrecords;
shared numbervar subtotal;
numbervar sumx := sumx + subtotal;
numbervar gtx := gtx + subtotal; - Placed this formula in the higher group footer: whileprintingrecords;
numbervar sumx;