Microsoft said:
OK here is what I have - any clearer?
Thanks for your help
In the SectionGrp Header is the following:
=[SectionGrp] & IIf([txtHdrCount]>1," continued","")
The txtHdrCount is in the SubSectionGrp Header
In the SubSectionGrp Header is the following:
=" - " & [SectionGrp2] & IIf([txtLineItem]>1," continued","")
txtLineItem is a counter in the Detail Section
In the OnFormat Event of SubSectionGrp Header is the following code:
Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As Integer)
Me.txtSectionGrp2.Visible = True
If txtSectionGrp2 = " - " Then
Me.PrintSection = False
Me.MoveLayout = False
ElseIf txtSectionGrp2 = " - continued" Then
Me.PrintSection = False
Me.MoveLayout = False
ElseIf txtSectionGrp2 = "" Then
Me.PrintSection = False
Me.MoveLayout = False
End If
End Sub
I will assume that both txtHdrCount and txtLineItem are text
boxes with expression =1 and RunningSum Over Group.
As I suspected, the expression in the section group header
is inadequate. It should be:
=SectionGrp & IIf(txtHdrCount>1 OR txtLineItem>1,"
continued","")
Your code for the subsection header is overly complex:
The second ElseIf can never happen.
The If and first ElseIf can only happen if SectionGrp2 is
Null or a zero length string. If this ever happens, it
seems like there might be a flaw in your data. What does it
mean to have an unnamed subsection with empty details?
Depending on the report's record source, it could mean that
you have records with no data, which is a usually a symptom
of something wrong in a data entry form.
If you really have a reason for that kind of record in the
report's record source table/query, then the code could
simply be:
Cancel = (Nz(SectionGrp2, "") = "")