Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

Active Reports 6 – How to communicate from sub report to parent report

The following illustrates one way to communicate information from a sub report back to its parent or main report. It may not be the cleanest way, but it works.

Let’s say you have a main report, RPT-001.rpx. This report has a page header. We already suppress the page header for page 1 and produce it for the remainder of the pages. (Interrogate rpt.pagenumber = 1 in the ActiveReport_PageStart to handle this).

Now, this report calls five sub reports. The user asks to suppress the page header of the entire report for the last sub report, SUB-RPT-005.rpx (as we will call it here for example).

Here is how it can be done:
1) Add a textbox to your report header of the main report (Let’s call it txtSuppress). Set its Visible property to False. Set its DataField property to String.Empty (or blank).
2) In the ActiveReport_PageStart sub routine of the main report, add the following logic:

If txtSuppress.DataField = "SUPPRESS" Then
    ‘Set all your controls Visible property = False
    ‘Set the Height of your page header Name = 0
Else
    ‘Set all your controls Visible property = True
    ‘Set the values of all your controls for display
    ‘Set the Height of your page header Name = design-time height
End If

3) In the last sub report, SUB-RPT-005.rpx, add the following logic to the ActiveReport_ReportStart sub routine:

rpt.ParentReport.Sections("your main report’s page header Name").controls("txtSuppress").DataField = "SUPPRESS"

So, what is going on here?

All the sub reports get processed in the main report’s ActiveReport_ReportStart section first. That means the logic (Step 3 above) in our last sub report, SUB-RPT-005.rpx, sets the DataField property of our invisible textbox, txtSuppress, on our main report next.

Lastly, the ActiveReport_PageStart sub routine of the main report gets executed. Since we initialized our txtSuppress.DataField = String.Empty, the If statement (Step 2 above) checks for a value of “SUPPRESS” in order to set the visibility of our controls in the page header of the main report to False and sets the height = 0 with the result of NOT seeing the page header for sub report SUB-RPT-005.

Leave a Reply