Setting the RepeatSection property in code

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.
 
F

fredg

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top