Page Breaks for Groups

mmj

Registered User.
Local time
Today, 07:24
Joined
Apr 2, 2010
Messages
15
I have created a combined report that displays 7 subreports. Each subreport is contained within a GroupHeader and displayed only if the name of the report has been checked in the table.

I want each subreport to display on a separate page. I tried putting a page break after the subreport in the GroupHeader section and then entered Code to only display the pagebreak if one of the subreports following it was checked on in the table. All of the reports display correctly on separate pages and only appear if they are checked on.

The problem I am having is if there is any space after the pagebreak, then a blank page appears after the subreport and if I move the window so it is flush with the pagebreak (where there is no space below the pagebreak) then it will only display the first page of the subreport (the remaining pages are cut off).


I have tried moving the pagebreaks (to before/after the subreport) and adjusting the height of the header window, but it just goes back and forth between having a blank page after the full subreport or cutting off the subreport after the first page.

I am fairly new to access, so I hope I have explained the problem clearly enough. I would appreciate any help you can give.

Please let me know if you need additional information.

Thanks!
 
What about putting the page breaks and the subreports tightly together?
 
I have tried putting them as tightly together as possible. But it only displays one way or the other, with blank pages, or cuts off the report.
 
Don't put in page breaks. Go to the section involved and set the FORCE NEW PAGE property. If you have a group that you want a new page after the group go to its FOOTER and set that property to AFTER SECTION.
 
I tried using the Force New Page property on the groups, but it only works some of the time. I have an If Then statement which determines whether each group is displayed or not. Could this be causing the problem?

If Me.AttachmentsContinuationSheet = True Then
Me.GroupHeader6.Visible = True
Me.Detail.Visible = False
Me.GroupFooter6.Visible = True
Me.PageFooterSection.Visible = True
Else
Me.GroupHeader6.Visible = False
Me.Detail.Visible = False
Me.GroupFooter6.Visible = False
Me.PageFooterSection.Visible = False
End If
 
That could well be a contributory factor. It's hard to diagnose without seeing the report.

Instead of hiding the section, hide the subform.
 
So if I hide the subform instead of the group, where do I specify when to insert a page break or Force New Page?


I inserted a page break at the end of each subform and then changed the code to hide the subform unless the associated box was checked in the table. This solves the blank page issue and the reports are not being cut off. The problem is that I have a Page Footer that displays a different footer label for each subform. Because a page break is being inserted after the subform, it is occurring before the Page Footer assigns it's label, so the labels are incorrect.

Any suggestions, or is there a different way I should go about this?
 
Here is a stripped down version of my dbase. Choose I SiteID from the dropdown and hit Preview Combined Report. This is the setup that is closest to what I want. I set the ForceNewPage to Before for each Group Header and then used Code to determine whether or not the Group Header should be displayed.

This setup gives extra blank pages at the end, but no blank pages in the report and the footer is correct, although doesn't show up sometimes. The letter in the title should match the letter in the footer.

Let me know if you need any additional explanation.

Thanks!
 

Attachments

Last edited:
I think you have a bit of a problem here as you have 9 groups which doesn't work the way you envision it. They are a hierarchy so the first group is grouped and the second group is grouped within that first group and then the third group is grouped within the second group which is grouped within the first group, and so on down the line.

You need ONE group for all of your different sub reports and a good way to do this is to use a tab control (I know it sounds strange for a tab control on a report) but you have a tab control with the same name as the sub reports and then you can put code like this in to the format event of the report group:
Code:
For Each ctl In Me.tabDetail.Pages
    If Not (ctl.Tag = "") Then
        ctl.Visible = InStr(1, ctl.Tag, Me.txtStatus_ID)
    End If
Next ctl

This is how we do a similar type of thing at my work. In each page you put the tag for the page number in and in your case you would use something else for txtStatus_ID (not sure at this point what to use, but if I get time I'll try to work up a sample based on your database).
 
Interesting. I didn't think about it that way. I will give it a try. And if you have time to work out a sample, that would be awesome. Thanks!
 
Last edited:
I am a little confused on how this works.

Should I have a separate Tab control for each subreport (so 9 separate Tab controls) with the Name of the Tab control the same as the Name of the subreport. Or do I have a Tab control with each page as a separate subreport?

"In each page you put the tag for the page number in"
What page number are you referring to?

I also cannot get anything to display on the Report Preview when using the Tab Control.

Sorry for all the questions. I did some research and thought I could figure this out, but I'm pretty stuck.

Thanks for any help you can give.
 

Users who are viewing this thread

Back
Top Bottom