[AccessD] Conditional Page Break from Subreport revisited

Andy Lacey andy at minstersystems.co.uk
Thu Jun 3 05:24:58 CDT 2004


Ok, another idea. How about this?
1-Remove the Page Break control
2-Create a Sort Group, with a Group Header, based on your order line level,
ie you'd have this print for every Detail line.
3-Set that Group Header to Force Page Break
4-In the OnFormat of that Group Header section test your Qty and Cancel the
section if you don't need the break.

This is untested and off the top of my head. Just thinking of other ways to
skin this cat. Oh and I've often found that you can't rely on
FormatCount/PrintCount, so it's best to find a method where it won't matter
if poss.


--
Andy Lacey
http://www.minstersystems.co.uk



--------- Original Message --------
From: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
To: AccessD at databaseadvisors.com <AccessD at databaseadvisors.com>
Subject: [AccessD] Conditional Page Break from Subreport revisited
Date: 03/06/04 08:19

>
> Have done some further work on this since yesterday's post - revised
> questions below.
> Would appreciate any pointers anyone can give me ...
>
> I have a standard type report based on Order / Order Line tables  with
> Order Report [WHD_Ord] and Order Line Subreport [WHD_Line_Sub] - no
> sorting or grouping in either report.
>
> I need to force a new page whenever the sum of [Qty] field in
> [WHD_Line_Sub] >= 3 .
> (ie no more than 3 items allowed per page)
>
> I have got so far:
> Add Text box in [WHD_Line_Sub]
> Name = RunSum
> Control Source = [Qty]
> Running Sum = Over All
>
> Add PageBreak [WHDL_PBreak] in detail section of [WHD_Line_Sub]
>
> Add to Page Header of [WHD_Ord]
> Private Sub PageHeader_Format(Cancel As Integer, FormatCount As Integer)
> Reports![WHD_Orders]![WHD_Line_Sub].Report![WHDL_PBreak].Visible = False
> End Sub
>
> Add to Detail - On Format of [WHD_Line_Sub]
> Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
> If FormatCount = 1 Then
>     If y = Empty Then y = 3
>     x = Me.RunSum
>     If y Mod x = 0 And x > 1 Then
>         MsgBox ("Force New Page" & " " &
Me.RunSum & " " & Me.Title)
>         Me.WHDL_PBreak.Visible = True
>     End If
> End If
> End Sub
>
> 1- Should the page break be in the subreport detail section or main
> report detail section ? -  as set out above  no page break is occuring .
> 2 -The Detail - On Format section of code in the subreport runs through
> twice even though I've checked the FormatCount property - why is this?
>
> Regards
> Robin Lawrence
> robin at rolledgold.co.uk
>
> --
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>
>
>
>
>

________________________________________________
Message sent using UebiMiau 2.7.2




More information about the AccessD mailing list