How to change color of item inside subreport within page header/footer

  • rgorr 5 months ago

    I have a report where there is a sub report inside its page header and footer.

    The subreports have a control inside that needs to change color based upon a value in the detail section.

    I tried to pass a parameter into the subreport inside the detail format sub(as well as page header format and page footer format), but it does not seem to work. The color almost seems random.

    Here’s the code I used for that:

    If DateDiff(“d”, e100_date, dNewImageDate) <= 0 Then
                Subreport1.Report.Parameters("Parameter1").Value = True
                Subreport2.Report.Parameters("ShowNewLogo").Value = True
                Subreport1.Report.Parameters("Parameter1").Value = False
                Subreport2.Report.Parameters("ShowNewLogo").Value = False
            End If

    e100_date being a value set in FetchData, and dNewImageDate being a static value that is set at the top of the page.

    If I avoid using sub reports I can get the item to change color correctly to match the detail item on the page, but there are several reports doing this same thing so getting this to work with sub reports would be very useful.

  • 18p
    Ruchir Agarwal18p 5 months ago


    For changing the controls color inside SubReport, placed in main report’s PageHeader/Footer section, you would need to set the SubReport’s parameter value in main report’s “DetailFormat” event but change the color of controls (by checking the Parameter’s value) in Detail’s “BeforePrint” event of sub report rather than “DetailFormat” event. Because when a SubReport is placed in PageHeader section of main report then, “DetailFormat” event of sub report is fired before “DetailFormat” event of main report.
    Also, since you are willing to change the controls color of PageHeader/Footer based on a detail item, I would like you to make sure that there exists only one detail section on one page, since having multiple detail sections in one page and changing PageHeader/Footer properties according to them would not generate desired results.

    I have attached a sample application for reference.

    Let us know if you the above solution does not meet your requirement.

    Ruchir Agarwal

  • rgorr 5 months ago

    I tried this and followed the code in your project, however it is still not working correctly. The header and footer color will change but not on the correct page, it changes a page before it is supposed to.

    I am never displaying more than one detail item per page, however there are some cases where one detail item will take up two pages.

    I could not run your sample project to verify if it works the same way because I only have up to Active Reports 10.

  • 18p
    Ruchir Agarwal18p 5 months ago


    I verified the application and the PageHeader/Footer seems to change correctly at my end.
    Hence, I have modified the application to ActiveReports10 and attached the same in order for you to run the application at your end, and verify if you face the same issue using the application.
    (Desired output: The PageHeader/Footer controls should change to red color if “e100_date”is less than “dNewImage”)
    If the issue replicates, then I would request you to please share the exact ActiveReports version you are using.

    Thanks & Regards
    Ruchir Agarwal

  • rgorr 5 months ago

    Thank you for the second sample project!

    I was able to figure out what my problem was after reviewing it: The NewPage property on the detail view needed to be set to “After”(mine was set to “None”). This didn’t change the display of anything else on my report, but it made the header and footer display correctly based on the dates in the detail.

    Thank you again for your prompt support.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.