Robin Lawrence
rgilimited at btconnect.com
Thu Jun 3 03:19:51 CDT 2004
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