MS Access Forum / Reports / Printing / January 2006
"Contd from previous page" when groupheader or pageheadersection..
|
|
Thread rating:  |
Odniel - 11 Jan 2006 16:35 GMT I am asking for more help because I really need it.
I have a report with a subreport in it. The page format is as follows:
Product ID [Subreport showing each item per product]
I would like "Contd from previous page" to show up at the top of each page whenever the subreport flows into the next page. I have tried the following code:
If Me.GroupHeader0.HasContinued = True Then Me.Label76.Visible = True Else Me.Label76.Visible = False End If
I have also tried the same code with "PageHeaderSection" instead of "GroupHeader0." The result, time and again, is that the "Contd" message shows up at random, not every instance, as is desired.
What can I do to have the message show up at every time the subreport flows into the next page?
Your help is very much appreciated!
Marshall Barton - 11 Jan 2006 17:31 GMT >I have a report with a subreport in it. The page format is as follows: > [quoted text clipped - 16 lines] >What can I do to have the message show up at every time the subreport flows >into the next page? We need more specific information about the main report.
What section is the subreport in? If the subreport is in the group header section, your posted code should work. If it's in the detail section then your code may be doing what you told it to do, but it would have nothing to do with the subreport (Will/Has Continued only deals with a single section, not a group of details).
Is the subreport the only item in the detail (or whatever) section? If it is, then you can use the HasContinued property of the detail section. If there is other stuff that you don't want included under the "Cont'd" label, then you will need another mechanism to accomplish theis goal.
Is there only the single subreport in the section or are there other subreports, each with it's own "Cont'd" label?
In the more complex situations, I think one way to get what you want might be to use the subreport itself to manage the "Cont'd" label. Use the subreport's Report Header's Format event to make the label visible: Me.Parent.Label76.Visible = True and similarly for making it invisible in the subreport's Footer section.
 Signature Marsh MVP [MS Access]
Odniel - 11 Jan 2006 18:22 GMT The group header contains product name and information from one table along with the subreport. The subreport contains all the items for each product.
Example: The product name is Belvedere, and it's details are dimensions and price. The subreport contains all the colors available for Belvedere.
The group header would have the name and the details to the left and right. The subreport is in the middle.
> >I have a report with a subreport in it. The page format is as follows: > > [quoted text clipped - 42 lines] > and similarly for making it invisible in the subreport's > Footer section. Marshall Barton - 11 Jan 2006 19:38 GMT I'm still not 100% sure what you're describing. You said that the product details are to the left and right of the subreport. I guess I should read that as there are product related field values next to the subreport and the detail section has some other kind of data that's not important to the problem.
With that understanding, I don't see why your code doesn't work as long as it's in the PageHeader section's Format event procedure.
Maybe it would help me figure out what's going on if you could find some kind of pattern to the "randon" appearance of the "Cont'd" label.
 Signature Marsh MVP [MS Access]
>The group header contains product name and information from one table along >with the subreport. The subreport contains all the items for each product. [quoted text clipped - 51 lines] >> and similarly for making it invisible in the subreport's >> Footer section. Odniel - 11 Jan 2006 20:23 GMT I do not see a concrete pattern.#1 Label76 appears at the top of the page when a group starts. #2 Less frequently, Label76 appears at the top of the page after a group ends on the previous page.
Example of #1 - The product "Marshall" begins on page 7. "Marshall Contd" shows up before Marshall even though the items for the preceding product do not flow from page 6 to 7.
Example of #2 - The product "Contemplation" begins and ends on page 2. "Contemplation contd" shows up at the top of page 3 .
> I'm still not 100% sure what you're describing. You said > that the product details are to the left and right of the [quoted text clipped - 65 lines] > >> and similarly for making it invisible in the subreport's > >> Footer section. Marshall Barton - 12 Jan 2006 17:47 GMT The only thing I can come up with that might explain that is if the section has some kind of blank space at the beginning and end that is crossing page boundaries without being obvious. A quick way to verify this hypothesis is to set the sections BackColor to Red. Unlikely as you missing this possibility is, it can be avoided by using the ForceNew Page - Before Section property.
If that's not the case, then maybe(??) you are using KeepTogether in some way that is confusing Access about which page the section starts and end on. I think I will give up on the Will/Has Continued feature altogether if it's subject to this kind of confusion.
Were you able to get the label turned off by using the code in the subreport's footer ?
 Signature Marsh MVP [MS Access]
>I do not see a concrete pattern.#1 Label76 appears at the top of the page >when a group starts. #2 Less frequently, Label76 appears at the top of the [quoted text clipped - 77 lines] >> >> and similarly for making it invisible in the subreport's >> >> Footer section. Odniel - 11 Jan 2006 20:06 GMT I tried applying the code to the subreport's report header On Format, and it works to a certain extent. Now I have to figure out how to make Label76 invisible when the subreport does not flow to the next page.
> >I have a report with a subreport in it. The page format is as follows: > > [quoted text clipped - 42 lines] > and similarly for making it invisible in the subreport's > Footer section. Marshall Barton - 11 Jan 2006 20:43 GMT I'm still thinking about the HasContinued issue.
To turn off the label when the sub report ends, use the subreport Report Footer section's Format or Print event. If the subreport does not have any data to display, just set its height to 0.
 Signature Marsh MVP [MS Access]
>I tried applying the code to the subreport's report header On Format, and it >works to a certain extent. Now I have to figure out how to make Label76 [quoted text clipped - 46 lines] >> and similarly for making it invisible in the subreport's >> Footer section. Odniel - 12 Jan 2006 21:10 GMT I got it to more or less where I want it by putting the product name in the group header section, and all the other info, including the subreport, in the detail section of the main report.
Now I have to filter out the duplicate product names that appear at the bottom of some pages when the next product group starts at the top of the next page.
Any ideas?
> I'm still thinking about the HasContinued issue. > [quoted text clipped - 52 lines] > >> and similarly for making it invisible in the subreport's > >> Footer section. Marshall Barton - 13 Jan 2006 01:16 GMT What do you mean "filter out the duplicate product names"?
If it just that you don't want the product name to appear in the detail, then remove that text box?
 Signature Marsh MVP [MS Access]
>I got it to more or less where I want it by putting the product name in the >group header section, and all the other info, including the subreport, in the [quoted text clipped - 61 lines] >> >> and similarly for making it invisible in the subreport's >> >> Footer section. Odniel - 13 Jan 2006 17:56 GMT I have put the desired effect into a statement:
"At the end of each page, [subreport detail] either continues or it does not.
If [subreport detail] will not continue, then [main report groupheader] starts on the next page.
If [subreport detail] continues, label76 appears on the next page."
Hopefully there's code to accomplish that. I've also tried manipulating the groupheader's settings, namely "Force New Page" and "Repeat Section."
> What do you mean "filter out the duplicate product names"? > [quoted text clipped - 65 lines] > >> >> and similarly for making it invisible in the subreport's > >> >> Footer section. Marshall Barton - 13 Jan 2006 20:42 GMT Your "statement" is not clarifying things for me. I thought we were talking about the subreport being split across a page boundary, for which I thought I provided and answer. Then you said something about "duplicate" products that I could not relate to anything we've discussed so far. Now it's starting to look like you want the "Cont'd" label to appear if some bunch of subreport details spans a page boundary, but maybe you are not talking about a bunch of details and only want the label if a single detail is split across two pages.
About the only thing I can say at this point is that the lines of code I posted earlier can probably be used at the appropriate places in the subreport to manage the label in the main report. If there was something about using the subreport's Report Header to make the label visible and the sunreport's Report Footer to make it invisible that doesn't do what you want, could you explain, via an example, What it is doing and what you want it to do?
 Signature Marsh MVP [MS Access]
>I have put the desired effect into a statement: > [quoted text clipped - 78 lines] >> >> >> and similarly for making it invisible in the subreport's >> >> >> Footer section. Odniel - 13 Jan 2006 22:11 GMT I'm sorry my statement sounds like something different. The situation is exactly as you put it: "using the subreport's Report Header to make the label visible and the subreport's Report Footer to make it invisible."
Problem is i'm new to all this and i'm trying to learn, understand, and apply simultaneously.
> Your "statement" is not clarifying things for me. I thought > we were talking about the subreport being split across a [quoted text clipped - 97 lines] > >> >> >> and similarly for making it invisible in the subreport's > >> >> >> Footer section. Marshall Barton - 13 Jan 2006 23:23 GMT I understand that things can be confusing with such a powerful tool as Access, especially in the beginning. However, these newsgroups are a text only communication medium and clear explanations and examples of the problem and hoped for solution are essential to a successful outcome.
I can only say that I have suggested a solution that you said worked in the subreport header and that you hadn't tried the part in the report footer. Although I assume that you tried something and that it's not doing what you want, I still don't know what you did or what the result looks like.
To reiterate, place the following line of code in the subreport Report Header section's Format event procedure: Me.Parent.Label76.Visible = True
and add the following line to the subreport's Report Footer section's Format event procedure: Me.Parent.Label76.Visible = False
 Signature Marsh MVP [MS Access]
>I'm sorry my statement sounds like something different. The situation is >exactly as you put it: "using the subreport's Report Header to make the >label visible and the >subreport's Report Footer to make it invisible." Odniel - 16 Jan 2006 14:50 GMT It worked, with one small problem: The product name is being repeated sometimes when the subreport does not flow to the next page. Two examples:
1) "Belvedere" (the product name) appears at the bottom of the page and at the top of the next page when the group for "Belvedere" starts at the next page.
2) The group for "Parallel" starts and ends on page 7, but the word Parallel appears at the top of page 8, right on top of "Parasol" (the next product name in sequence).
Other than those two instances, the code works great.
> I understand that things can be confusing with such a > powerful tool as Access, especially in the beginning. [quoted text clipped - 20 lines] > >label visible and the > >subreport's Report Footer to make it invisible." Marshall Barton - 16 Jan 2006 16:10 GMT I can only think of a couple of things that might cause that effect.
One is that the subreport actually has a small bit of blank space on the next page. This might happen if you have some blank space after the last control in a section or if a section (subreport Report Footer?) is blank. An easy way to check for this is to temporarily set the BackColor of each section to a different color so you can see exactly where they start and end.
My other thought is that maybe there is a KeepTogether property set somewhere that moves the subreport to the next page after the attempt to format at the end of a page fails. In this kind of situation, you can try using the Subreport Report Header and Footer section Print event to run the code (instead of the Format event).
 Signature Marsh MVP [MS Access]
>It worked, with one small problem: The product name is being repeated >sometimes when the subreport does not flow to the next page. Two examples: [quoted text clipped - 33 lines] >> >label visible and the >> >subreport's Report Footer to make it invisible." Odniel - 16 Jan 2006 17:21 GMT You're first thought is dead-on. The Main Report's GroupHeader is double-spaced. How do I correct that?
> I can only think of a couple of things that might cause that > effect. [quoted text clipped - 50 lines] > >> >label visible and the > >> >subreport's Report Footer to make it invisible." Marshall Barton - 16 Jan 2006 19:29 GMT I don't know what you mean by "double spaced", but generally you should open the report in design view and drag all the controls as close to the top of the section as you want them. Then, drag the bottom of the section higher than some control. When you release the mouse button, the bottom of the section will snap to its minimum allowable position. This may be sufficient to prevent the problem we've been working on all this time.
You can squeeze out unneeded white space between controls by dragging some controls to where you really wanted them. It's often best to start the selection of the controls by first dragging a selection box around all the controls below the white space so you can drag them up as a group without disturbing their distance from each other.
 Signature Marsh MVP [MS Access]
>You're first thought is dead-on. The Main Report's GroupHeader is >double-spaced. How do I correct that? [quoted text clipped - 53 lines] >> >> >label visible and the >> >> >subreport's Report Footer to make it invisible." Odniel - 16 Jan 2006 19:52 GMT I did that, but the groupheader seems to sometimes go from the bottom of one page to the top of the next page. I can tell that happens when I change the background color.
That problem is fixed when I set "repeatsection" to "no" but that, in turn, causes the label76 to disappear.
> I don't know what you mean by "double spaced", but generally > you should open the report in design view and drag all the [quoted text clipped - 68 lines] > >> >> >label visible and the > >> >> >subreport's Report Footer to make it invisible." Marshall Barton - 16 Jan 2006 21:07 GMT Try setting the group header section's KeepTogether property to Yes.
I don't know if you want multple groups on a single page if it will fit, but if each group is supposed to start on a new page, then you might want to explore setting the group header section's ForceNewPage property to Before Section instead.
 Signature Marsh MVP [MS Access]
>I did that, but the groupheader seems to sometimes go from the bottom of one >page to the top of the next page. I can tell that happens when I change the [quoted text clipped - 78 lines] >> >> >> >label visible and the >> >> >> >subreport's Report Footer to make it invisible." Odniel - 16 Jan 2006 21:35 GMT I would like as many groups per page as possible.
> Try setting the group header section's KeepTogether property > to Yes. [quoted text clipped - 86 lines] > >> >> >> >label visible and the > >> >> >> >subreport's Report Footer to make it invisible." Marshall Barton - 16 Jan 2006 23:56 GMT OK, scratch the Force New Page idea.
What happened when you tried the KeepTogethen property
 Signature Marsh MVP [MS Access]
>I would like as many groups per page as possible. > [quoted text clipped - 13 lines] >> >That problem is fixed when I set "repeatsection" to "no" but that, in turn, >> >causes the label76 to disappear. Odniel - 17 Jan 2006 00:35 GMT Sorry, I lost track of all the changes I made. This is what I have now:
Subreport: Report Header has "Me.Parent.Label76.Visible = True" Report Header settings: Force New Page = None Keep Together = Yes
Group Header settings: Force New Page = None Keep Together = No Repeat Section = No
Report Footer has "Me.Parent.Label76.Visible = False"
Main Report: Group Header settings: Force New Page = None Keep Together = Yes Repeat Section = Yes
Detail settings: Force New Page = None Keep Together = No
Result? Now, Label76 shows up right on top of the group that starts on a new page as well as the way I want it to show.
Example: At the top of page 3, "Andrew" appears atop the "Andrew" group, which begins at the top of the page and ends on page 3. The problem with that is that "Andrew" already appears as the product name, so it looks the name appears twice.
> OK, scratch the Force New Page idea. > [quoted text clipped - 16 lines] > >> >That problem is fixed when I set "repeatsection" to "no" but that, in turn, > >> >causes the label76 to disappear. Marshall Barton - 17 Jan 2006 03:33 GMT Ahem, you can not suppress a Repeat Section Group Header section on some pages.
Actually, I have to ask why you want it to be different at the top of a page from the same thing in the middle of the page?
Where is the second copy of the product name coming from? It sounds like it might be in the detail section. If so, isn't that redundant and shouldn't it be removed from the detail? Even if it's coming from the subreport, it still seems redundant to me??
 Signature Marsh MVP [MS Access]
>Sorry, I lost track of all the changes I made. This is what I have now: > [quoted text clipped - 50 lines] >> >> >That problem is fixed when I set "repeatsection" to "no" but that, in turn, >> >> >causes the label76 to disappear. Odniel - 17 Jan 2006 16:01 GMT I'm sorry, what I meant to say was that the label should not appear when nothing continues from the previous page. That's what it's doing, at random.
> Ahem, you can not suppress a Repeat Section Group Header > section on some pages. [quoted text clipped - 62 lines] > >> >> >That problem is fixed when I set "repeatsection" to "no" but that, in turn, > >> >> >causes the label76 to disappear. Marshall Barton - 17 Jan 2006 18:29 GMT Are you saying that the Repeat Section header duplicates the new group's header? For example, does it look like this
groupA details groupA footer --newpage-- groupB header (Cont'd) GroupB header GroupB details . . .
If that's what you're saying, I have never seen that behavior and don't see how it can happen, especially since the group header has its KeepTogether is set to Yes.
 Signature Marsh MVP [MS Access]
>I'm sorry, what I meant to say was that the label should not appear when >nothing continues from the previous page. That's what it's doing, at random. [quoted text clipped - 41 lines] >> >> >> >That problem is fixed when I set "repeatsection" to "no" but that, in turn, >> >> >> >causes the label76 to disappear.
|
|
|