How to pass a parameter from main report to subreport in crystal reports

I have a main report that takes an orderID to display order item details.

Within this report I have inserted a sub-report that displays details based on an specific line item based on orderID and Line_Number

Sub report works fine by itself, but what I am trying to learn is how to get the 2 variables needed from the main report and pass them to the sub-report. Currently main Packing List report uses orderID as the keyword. The sub-report "PackingList Line Item Detail" would use orderID, and Line_Number to display its information.

PLease any help on this would be appreciated it.

If I need to provide more details, or a copy of the report, I can do that.

Thank you.

Who is Participating?
mlmccConnect With a Mentor Commented:
You can link the suubreport to the main report using the parameters.

Right click the subreport
Select the OrderId parameter from the main report
If there is an orderid parameter in the subreport choose it (not the ?pm-OrderId Crystal adds)
Same for the LineNumber

metropiaAuthor Commented:
do i need to create selection formulas at all?
metropiaAuthor Commented:
i have to parameters on main report OrderID and Line_No
and the same 2 parameters on subreport OrderID and Line_No

I followed your instructions, and when i refresh the report, it breaks. The report tries to load all records, not the records for the parameteres entered.
If you link on the subreport parameters then you will have to create the selection formula

All Courses

From novice to tech pro — start learning today.