How to pass the data from subreport to parent report?

Posted by: kyawym on 4 August 2017, 3:01 pm EST

  • Posted 4 August 2017, 3:01 pm EST

    Hi,


    I have one report with two sub-reports.


    Each sub-reports have some calculated fields at run-time.


    I want to show the total fields in main report by adding the two fields from two sub-reports.


    Is there any way to pass the data from sub-report to parent report?


    thanks in advance.


    Regards,


    Kyaw


     


     

  • Replied 4 August 2017, 3:01 pm EST

    Is the ParentReport property Read-Only or Read-Write?


    The Help file say that property is read-only. Is it correct?


    FYI : I use Active Report 2.0 .

  • Replied 4 August 2017, 3:01 pm EST

    It is a read-only meaning you can not set it to a report but you can use it to change values in the parent report. Have you tried it to change a value of a public variable or a text box on the parent report?
  • Replied 4 August 2017, 3:01 pm EST

    You can use the ParentReport property to access to pass values to the parent report. For instance to set a field control on the parent report from the summary field in a subreport:

    Me.ParentReport.txtOrderTotal.Text = txtExtPriceTotal.Text

    txtOrderTotal is a Field control on the parent report and txtExtPriceTotal is a field in the subreport where you summarize the calculated field. Similarly, you can add to the value of a variable in the parent report from each of the two subreports.
  • Replied 4 August 2017, 3:01 pm EST

    Hi Ali,


    When I use that property in subreport, I got that following error.


    Err 5000 : Error in processing report
    [ Extended Info : SubReport for control SubCurr failed. Failure due to
    : Source : Report, Event : OnFetchData, Line number: 136
    Description: Object required: 'rpt.ParentReport']


    Please advise.


    Thanks a lot.


     


    Regards,


    Kyaw


     

  • Replied 4 August 2017, 3:01 pm EST

    Can you please post the code you have in OnFetchData.
  • Replied 4 August 2017, 3:01 pm EST

    Hi Ali,


    I got it. :)


    I put the subreport in the group, gfCcyCode.


    My subreport control's name is "SubCurr".


    In the OnAfterPrint event of gfCcyCode, I put the following code.


    rpt.txtTotalInvoice.DataValue = rpt.sections("gfCcyCode").Controls("SubCurr").object.txtTotalInvoice.DataValue


    Anyway, Thanks a lot. :)


    Regards,


    Kyaw


     

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels