Hide/Unhide group header on main report within subreport

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Etienne1
    New Member
    • Feb 2010
    • 6

    Hide/Unhide group header on main report within subreport

    Hello,

    I have a report with a subreport that has a subreport that as a subreport and so on. I have so far 6 levels and each of them is linked to his parent. What I'm trying to do is when a new page starts, I want to show the names of his parents.

    Now, what I was thinking to do that is to create 5 groups on the main report and hide/unhide them depending on the level that is starting the new page. Of course, everytime a new level appears, the name would be save in a textbox that would be shown in the appropriate groups.

    Example:
    (Page 1)
    Level 1
    Level 1
    Level 2
    Level 2
    Level 1
    Level 2
    Level 3
    Level 3

    (Page 2) - This page starts with a level 4
    Level 1 <- Parent of level 4
    Level 2 <- Parent of level 4
    Level 3 <- Parent of level 4
    Level 4 <-Starts here
    Level 3
    Level 1
    ...


    The problem I have is that I can't hide/unhide a group header on the main report within a subreport in a detail_print event. Any clue?
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    #2
    You need to attach the event to the groupHeader_For mat not the detail_Format.

    Im not sure if thats the best way to go about it, but then again im not 100% sure I understand what you want to do :)

    Welcome To Bytes.

    Comment

    • Etienne1
      New Member
      • Feb 2010
      • 6

      #3
      It's hard to explain like you can see :) Is there a way to hide/unhide a group section of a main report within a subreport like MyMainForm.Grou pHeader.Visible (I did that with the print_detail event of my subform but it doesn't work). I know you can do it from a report to a subform... MySubReport.Gro upHeader.Visibl e

      Comment

      • TheSmileyCoder
        Recognized Expert Moderator Top Contributor
        • Dec 2009
        • 2322

        #4
        As I said...put it in the format event of the groupheader.
        Code:
        Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
            Me.GroupHeader0.Visible = MyCondition
            
        End Sub

        Comment

        • Etienne1
          New Member
          • Feb 2010
          • 6

          #5
          The problem doing that there is that I don't know what is the level of the first item listed in my subreport...

          Depending on the level of the first item of each page, it will hide/unhide a group header to show his parents (in the main report).

          You can see that as a table of content but on each page I rewrite the parents of the first item of the current page.
          1
          1.1
          1.2
          1.2.1
          2
          2.1
          ...
          Level 1 = 1,2 is on my main report
          Level 2 = 1.2,2,1 is on a subreport on the main report
          Level 3 = 1.2.1 is on a subreport into the subreport of level 2

          When I'm on page 2 and the first item listed is 1.2.1, I want to write above his parent. The page will beging with
          1
          1.2
          and then 1.2.1

          Comment

          • TheSmileyCoder
            Recognized Expert Moderator Top Contributor
            • Dec 2009
            • 2322

            #6
            And simply setting groupheaderLeve l1 to repeat on top of each page is not good enough?

            Comment

            • Etienne1
              New Member
              • Feb 2010
              • 6

              #7
              There will be a blank space if there are no level 2 yet. That's why I was thinking to hide/unhide the groupHeaderLeve l1...

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32656

                #8
                Why would you not do this in the PageHeader section?

                You could format that to display the relevant value depending on what stage it finds itself at. Am I on the right lines here? I too have a little difficulty envisaging what you're after.

                Comment

                • Etienne1
                  New Member
                  • Feb 2010
                  • 6

                  #9
                  I create a page header section for each level and then when a new page begin, I hide/unhide what I want and what I don't want. Of course every levels appearing will change the value of a textbox that will contain the name of the level.

                  For example, let say I have 3 levels:
                  PageHeaderLevel 1
                  PageHeaderLevel 2
                  PageHeaderLevel 3

                  Those pageHeader are on the main report.

                  By default all those page headers are hidden.

                  Every time a new item appears, I know what the level of this item is. I then change the appropriate textbox value.

                  When a new page begin, I look at the first item and then I know what his level is. I then hide/unhide the pageHeaderLevel . So if the first item on the new page is a level 3, I would hide PageHeaderLevel 3 and unhide PageHeaderLevel 1 and PageHeaderLevel 2.

                  The problem with that is I can't figure how to hide/unhide a pageHeaderSecti on within a subreport to the main report.

                  Comment

                  • NeoPa
                    Recognized Expert Moderator MVP
                    • Oct 2006
                    • 32656

                    #10
                    Originally posted by Etienne1
                    I create a page header section for each level and then when a new page begin,
                    You see this is where it gets difficult if you use wrong terminology. There cannot be more than one PageHeader Section per report, so you must mean something else. Are we to guess what that may be, or are you going to find out what you really mean and tell us that. If you didn't understand the importance of communicating accurately beforehand, I certainly hope you do now.

                    Comment

                    • Etienne1
                      New Member
                      • Feb 2010
                      • 6

                      #11
                      What I mean by PageHeaderLevel 1 (=1), PageHeaderLevel 2 (=2) and PageHeaderLevel 3 (=3) is in fact page groups I've created.

                      I hope it's more accurate for you now.

                      Comment

                      • NeoPa
                        Recognized Expert Moderator MVP
                        • Oct 2006
                        • 32656

                        #12
                        Do you mean Groups and their Headers?

                        Page Groups makes no more sense than PageHeaderLevel . If you stop and actually think about it, the whole point of the problem is in the difference between what you're doing and what you're saying. It's very hard to explain something to someone when they don't even recognise what they're saying. How can I explain it to you? What terms could I use that would make sense to you? I've already pointed you at your problem, but you didn't see it.

                        Comment

                        Working...