[AccessD] Sub-Reports and Paging

Brett Barabash BBarabash at TappeConstruction.com
Mon May 5 16:23:24 CDT 2003


Charlotte,
Yes, each subreport has to be in a separate section.  That's the only way I
found to fire a Format event for each subreport.


-----Original Message-----
From: Charlotte Foust [mailto:cfoust at infostatsystems.com]
Sent: Monday, May 05, 2003 4:13 PM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] Sub-Reports and Paging


Won't this only work if you use sections for the subreports?  Rocky may
be able to use the idea, but unfortunately our reports contain too many
subreports for that approach.  

Charlotte Foust  


-----Original Message-----
From: Brett Barabash [mailto:BBarabash at tappeconstruction.com] 
Sent: Monday, May 05, 2003 1:03 PM
To: 'accessd at databaseadvisors.com'
Subject: RE: [AccessD] Sub-Reports and Paging


Rocky,
My solution doesn't force a page break between each subreport.  It just
keeps the subreports from being split between pages (in which case it
would force a break then).

Now, your second problem was "how do I break to the next page if I am xx
lines from the bottom?"  This can be done in the Format event by using
the .NextRecord and .MoveLayout properties.  For the purposes of this
discussion, let's assume that you placed the subreport in it's own
header (or footer) and the header was named MyHeader.  The code would
look something like:

Private Sub MyHeader_Format(Cancel As Integer, FormatCount As Integer)

    If Me.Top > 12000 Then
        'Reformat output in next section
        Me.NextRecord = False
        Me.MoveLayout = True
        Me!srptMySub.Visible = False
    Else
        Me!srptMySub.Visible = True
    End If

End Sub

Pick whatever arbitrary number you want as a page break threshold.  The
Top property is in Twips, so multiply Inches by 1440 to get the number
(e.g. 10.5 * 1440 = 15120).

The only gotcha to look out for is the CanShrink property.  If you have
this set to True for the section, and you hide the section's contents
(i.e. the subreport), you will be caught in an infinite loop because
every subsequent formatting event will take place in the exact same
position!
-----Original Message-----
From: Rocky Smolin - Beach Access Software [mailto:bchacc at san.rr.com]
Sent: Monday, May 05, 2003 2:26 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Sub-Reports and Paging


Brett:

Thanks for your reply.

I don't want to force a page break between each sub-report.  Sometimes
they're only one line.  so they need to all flow together unless it's
close to the bottom of the page.  In that case the header text (4-6
lines) gets split over two pages (sometimes in the middle of the line
horizontally!) and sometimes it will do this to a detail line.  

Any idea how to 1) prevent that and 2) to force a page break when close
to the bottom of the page but not page break when in the sub report
starts in the middle of the page?

Thanks and regards,

Rocky

----- Original Message ----- 
From: Brett Barabash 
To: 'accessd at databaseadvisors.com' 
Sent: Monday, May 05, 2003 10:22 AM
Subject: RE: [AccessD] Sub-Reports and Paging


Rocky,
Normally, I create a section for each subreport.  This allows me full
control over the page breaks:
- In the Sorting And Grouping box, type ="My Section" (call it whatever
you want, extra points for being descriptive), and set Group Header =
Yes.  This will create a report header where you can place your
subreport.
- In the Report Header property sheet, set Keep Together = Yes.  Don't
forget to set your Can Grow and Can Shrink properties.
- Voila!  Access will not split a subreport in this section between 2
pages.  Plus, if you want to force a page break at the start of a
subreport you can easily do that by setting the section's Force New Page
property.

P.S. Access allows up to 10 headers and 10 footers per report.  They can
be referred to using the Me.Section property using the following
indices:
Me.Section(5) - Group header # 1
Me.Section(6) - Group footer # 1
Me.Section(7) - Group header # 2
Me.Section(8) - Group footer # 2
...
-----Original Message-----
From: Rocky Smolin - Beach Access Software [mailto:bchacc at san.rr.com] 
Sent: Monday, May 05, 2003 9:49 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Sub-Reports and Paging


Dear Rocky:

Perhaps you could put an invisible page break between each sub-report.
Then in the OnOpen event of the report, Dcount the records in each of
the eight sub-reports and estimate the height of the sub-report from the
sub-report's report header plus the number of detail records.  Then make
the page break visible to separate the sub reports.

Of course since one of the fields in the detail record 'can grow' and
does, it's going to be an estimate at best.  Also, this means
potentially a lot of white space on a page. Nah, that won't really work
well.  You need to know where you are on the page during the printing of
the sub-report and page when it gets close to the bottom.

Maybe someone else has an idea.

With my very best regards for you and your family,

Rocky Smolin
Beach Access Software

----- Original Message ----- 
From: Rocky Smolin - Beach Access Software 
To: AccessD at databaseadvisors.com 
Sent: Friday, May 02, 2003 5:18 PM
Subject: [AccessD] Sub-Reports and Paging


Dear List:

I have a report that consists of eight sub reports.  Each sub-report can
be of a different length.  Each sub-report has a report header with some
descriptive text.  

The problem is that the main report page breaks in odd places sometimes
even cutting a line of the subreport in half horizontally!

I can, of course, insert an invisible page break between each sub-report
and make it visible if I'm close to the bottom of the page.  But I don't
know how to know, during the printing of the sub-report, where I am on
the main report.

Anybody got any ideas?

MTIA,

Rocky Smolin
Beach Access Software

--------------------------------------------------------------------------------------------------------------------
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom
they are addressed.
If you have received this email in error please notify the
originator of the message. This footer also confirms that this
email message has been scanned for the presence of computer viruses.

Any views expressed in this message are those of the individual
sender, except where the sender specifies and with authority,
states them to be the views of Tappe Construction Co.

Scanning of this message and addition of this footer is performed
by SurfControl E-mail Filter software in conjunction with 
virus detection software.



More information about the AccessD mailing list