Setting the RepeatSection property in code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a report that sometimes I want a section header to repeat and
sometimes I don't. this is controlled by a check box on the criteria form
for the report.
According to the Access help you can set this property in code, but when I
do, it say the object can't be set.
Here is the code I am trying to use:
If [Forms]![wip]![ChkCoverSheet] Then
GroupHeader0.RepeatSection = True
Else
GroupHeader0.RepeatSection = False
End If
Any ideas why this doesn't work.
 
I have a report that sometimes I want a section header to repeat and
sometimes I don't. this is controlled by a check box on the criteria form
for the report.
According to the Access help you can set this property in code, but when I
do, it say the object can't be set.
Here is the code I am trying to use:
If [Forms]![wip]![ChkCoverSheet] Then
GroupHeader0.RepeatSection = True
Else
GroupHeader0.RepeatSection = False
End If
Any ideas why this doesn't work.

You can use code, just not within the report once it has opened.

On the wip form, code the event that opens the report:

' Set the RepeatSection property in the report
DoCmd.OpenReport "ReportName", acViewDesign, , , acHidden
Reports!ReportName.Section("GroupHeader0").RepeatSection =
Me![ChkCoverSheet]
' Save the change
DoCmd.Close acReport, "ReportName", acSaveYes
' Open the report in preview
DoCmd.OpenReport "ReportName", acViewPreview
 
Back
Top