3

I have a main report in which there are two sub reports and then those two sub reports each contain one sub-subreport.

The following will give you an idea

Main Report
----->Sub Report 1
     ------------>Sub Sub Report 1
----->Sub Report 2
     ------------>Sub Sub Report 1

I am trying to display name of subreport in footer of main report depending on which subreport user is currently in. So let's say if user is viewing Sub Report 1 then it should display in footer of main report "Sub Report 1" (this is actually coming from database and is not like displaying some static text but for the time being ignore this)

If user is viewing Sub Sub Report 1 then footer of main report should say "Sub Report 1: Sub Sub Report 1"

After searching a bit I found out that:

  1. Sub report footer will not be shown in Main report hence this option is ruled out
  2. You cannot pass parameter from sub report to main report so this option is also ruled out

But looks like you can use Shared Variables between Sub Report and Main Report. I tried to do this but looks like it doesn't work. Here's what I did:

In my Sub Report 1 I declared a shared variable as below:

Public Shared Dim sharedVariable as String = "Sub Report 1"

Now in my Main Report I wrote the following function in code just to test if it prints it on screen on not.

Public Function PrintSharedVariable() as String
    Return sharedVariable
End Function

But when I run this report, it shows error that sharedVariable is not declared in Main Report. How do I use shared variables and will it work in my case?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.