code for user to include/exclude page breaks

  • Thread starter Thread starter Janelle
  • Start date Start date
J

Janelle

I have a report options screen which allows the user to
choose various options for the report. I'd like them to
be able to check a box which would create a page break
after each category. How do i do this in code? I know
that I can set the ForceNewPage to 'After Section' on the
report itself, but every time i try to do it in code it
doesn't work.

This is the code I currently have in Report_Open sub:

If Forms![frmrptr_req]![chkBreak] = True Then
Reports![rptRptr_Req].Section
(GroupFooter0).ForceNewPage = 2
Else
Reports![rptRptr_Req].Section
(GroupFooter0).ForceNewPage = 0
End If

What am i missing?

Any help would be greatly appreciated.

Thanks!

Janelle
 
Janelle said:
I have a report options screen which allows the user to
choose various options for the report. I'd like them to
be able to check a box which would create a page break
after each category. How do i do this in code? I know
that I can set the ForceNewPage to 'After Section' on the
report itself, but every time i try to do it in code it
doesn't work.

This is the code I currently have in Report_Open sub:

If Forms![frmrptr_req]![chkBreak] = True Then
Reports![rptRptr_Req].Section
(GroupFooter0).ForceNewPage = 2
Else
Reports![rptRptr_Req].Section
(GroupFooter0).ForceNewPage = 0
End If

What am i missing?

You have mixed up the name of the section with its section
index. Either use:

Me.Section(acGroupLevel1Footer).ForceNewPage = 2
or
Me.GroupFooter1.ForceNewPage = 2

(the Reports![rptRptr_Req] part is OK, it's just easier to
use Me instead)
 
Thank you so much!!!!!!!!! I knew it was something easy
and that I was just missing. I really appreciate it.

Janelle


-----Original Message-----
Janelle said:
I have a report options screen which allows the user to
choose various options for the report. I'd like them to
be able to check a box which would create a page break
after each category. How do i do this in code? I know
that I can set the ForceNewPage to 'After Section' on the
report itself, but every time i try to do it in code it
doesn't work.

This is the code I currently have in Report_Open sub:

If Forms![frmrptr_req]![chkBreak] = True Then
Reports![rptRptr_Req].Section
(GroupFooter0).ForceNewPage = 2
Else
Reports![rptRptr_Req].Section
(GroupFooter0).ForceNewPage = 0
End If

What am i missing?

You have mixed up the name of the section with its section
index. Either use:

Me.Section(acGroupLevel1Footer).ForceNewPage = 2
or
Me.GroupFooter1.ForceNewPage = 2

(the Reports![rptRptr_Req] part is OK, it's just easier to
use Me instead)
 
Back
Top