469,964 Members | 1,713 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,964 developers. It's quick & easy.

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?
Feb 18 '10 #1
11 8535
TheSmileyCoder
2,321 Expert Mod 2GB
You need to attach the event to the groupHeader_Format 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.
Feb 18 '10 #2
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.GroupHeader.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.GroupHeader.Visible
Feb 18 '10 #3
TheSmileyCoder
2,321 Expert Mod 2GB
As I said...put it in the format event of the groupheader.
Expand|Select|Wrap|Line Numbers
  1. Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
  2.     Me.GroupHeader0.Visible = MyCondition
  3.  
  4. End Sub
Feb 18 '10 #4
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
Feb 18 '10 #5
TheSmileyCoder
2,321 Expert Mod 2GB
And simply setting groupheaderLevel1 to repeat on top of each page is not good enough?
Feb 18 '10 #6
There will be a blank space if there are no level 2 yet. That's why I was thinking to hide/unhide the groupHeaderLevel1...
Feb 21 '10 #7
NeoPa
32,233 Expert Mod 16PB
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.
Feb 21 '10 #8
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:
PageHeaderLevel1
PageHeaderLevel2
PageHeaderLevel3

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 PageHeaderLevel3 and unhide PageHeaderLevel1 and PageHeaderLevel2.

The problem with that is I can't figure how to hide/unhide a pageHeaderSection within a subreport to the main report.
Feb 22 '10 #9
NeoPa
32,233 Expert Mod 16PB
@Etienne1
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.
Feb 22 '10 #10
What I mean by PageHeaderLevel1 (=1), PageHeaderLevel2 (=2) and PageHeaderLevel3 (=3) is in fact page groups I've created.

I hope it's more accurate for you now.
Feb 22 '10 #11
NeoPa
32,233 Expert Mod 16PB
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.
Feb 22 '10 #12

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Steve Jorgensen | last post: by
1 post views Thread by shaqattack1992-newsgroups | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.