Kate said:
Hi, I have a report that contains the column headings for the detail
data in the group header, repeating at the top of each page. This is
because I have a subreport printing in the group footer, which has its
own different headings. I have a page break occurring before the group
footer, but can't figure out how to make the group header not print on
pages where the group footer prints.
I have always thought that there is no way to do that. Ever
since the RepeatSection property was intorduced, it has not
been able to deal with being displayed conditionally.
In A97, making the header invisible in its format event or
cancelling the format event sent the report into an infinite
loop.
In AXP, it seems as if MS added some code to prevent the
loop, but they did it with the simple expedient of turning
the RepeatSection property off (even though we can't change
it while the report is running) when the header section
tries to make itself invisible or cancel is set to true IN
THE FORMAT EVENT.
However, while playing around, I found that if you use the
print event to Cancel the event it seems(?) to work. Here's
the code logic I used in case you want to try it (NO
GUARANTEE):
Add an invisible text box named txtRecCnt to the group
header section and set its control source expression to
=Count(*)
Add an invisible text box named txtLineNum to the detail
section. Set its control source expression to =1 and it
RunningSum property to Over Group
**** Code in the report's module****
Dim bolLastDetail As Boolean
Private Sub Detail_Print(Cancel As Integer, PrintCount As
Integer)
bolLastDetail = (Me.txtLineNum = Me.txtRecCnt)
End Sub
Private Sub GroupFooter1_Print(Cancel As Integer, PrintCount
As Integer)
bolLastDetail = False
End Sub
Private Sub GroupHeader0_Print(Cancel As Integer, PrintCount
As Integer)
Cancel = bolLastDetail
End Sub
I do not have A2K and have not tried this in A2003 so I can
not state how those versions deal with this situation.