Files to look at:

How to implement a master-detail report using Subreports (XRSubreport) without parameter bindings

This example demonstrates how to implement a master-detail report using Subreports without parameter bindings but through the BeforePrint event of the XRSubreport.
Please refer to the How to implement a master-detail report using Subreports (XRSubreport) without parameter bindings KB article for implementation details.

NOTE: The subreport parameter bindings feature introduced in version 15.1 enables you to implement this without writing any code. For more information, see How to: Create a Master-Detail Report using Subreports.