conditionally set subreport?

  • Is it possible to conditionally set which subreport displays in a main report using the Report Name property of the subreport control?

    background: I have created an invoice main report but customers need back-up data to support what I am billing them. I added a subreport control and I want to pass a parameter to the main report which determines which subreport to show (if invoice type 1 show subreport type 1, if invoice type 2 show subreport type 2).

    Thanks in advance.

  • This is relatively easy, you simply add the two sub-reports to your main report, then on each sub-report right click and go to properties; go to the visibility tab; then go to the expression area and create and expression similar to the following:

    =IIF(Fields!InvoiceType.Value = 1, FALSE, TRUE )

    And on your second sub-report, the reverse of this

    =IIF(Fields!InvoiceType.Value = 1, TRUE, FALSE )

    The negetive aspect of this is that you do have to allocate a little space to each sub-report, all I do is to make the height of each of them as small as possible, this avoids big areas of whitespace on the document.

    Good luck,

    Nigel West
    UK

  • That was pretty easy. Thanks.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply