From: pemigh on 28 Apr 2010 16:59 Since explicit page break controls are ignored in subreports, I had a devil of a time getting things to display properly. My solution is below. The scenario: My main report sometimes has spec sheets that need to be printed along with the main information. These need to be included in overall pagination, and each needs to start on a new page. The spec sheets come in different flavors, and there may be 0, 1, or multiple spec sheets for each flavor. The spec sheets are actually sub-subreports since I created one subreport to hold them all. Main report was already very complicated, so this was mainly an attempt to hold on to some level of sanity while messing around with and troubleshooting page breaks. And heres what makes it all work: -- The first-level subreport has dummy group headers where the field/ expression is simply 1, and each spec sheet is in its own dummy group header. -- Each of these group headers has "Force new page" set to "after section." -- On each spec sheet, the first group header has "Force new page" set to "before section." -- A little bit of code is required to prevent extra blank pages. Each dummy group header on the containing subreport needs OnFormat code to set visibility based on check for null spec sheet report. This code exploits the fact that Error 2427 will fire if there is no spec sheet matching the data in this report: Private Sub Hdr1_Format(Cancel As Integer, FormatCount As Integer) On Error Resume Next varTestForNull = Me![rptSpecSheetInHdr1].Report![txtWhatever] If Err = 2427 Then Hdr1.Visible = False Else Hdr1.Visible = True End If Err = 0 End Sub Hope this helps somebody else, but even if not I'll probably need it myself some day. And now I'll be able to google it instead of trying to remember which report in which project holds the solution. (Too many projects, too many birthdays to be able to hold it all in this old brain.) Cheers! pemigh
|
Pages: 1 Prev: Update linked tables Next: Print One Report on two Printer Trays |