Force new page

  • Thread starter Thread starter Phil
  • Start date Start date
P

Phil

HI,

I have a form with a command button that previews a report
with a group on teachers and a group heading
called "GroupHeader2".

I want to place a check box on the form called "ckNewPage"
which if checked will cause the report to force a new page
for each teacher. What code would I use and where would
it go? I've tried many things but no success....

Thanks,
Phil
 
Use the Open event of the report to read the check box (if the form is
open), and set the ForceNewPage property of the group header:

Private Sub Report_Open(Cancel As Integer)
Const conNewPageBefore As Byte = 1

If CurrentProject.AllForms("NameOfYourFormHere").IsLoaded Then
If (Forms("NameOfYourFormHere")!chNewPage.Value) Then
Me.Section(acGroupLevel1Header).ForceNewPage = conNewPageBefore
End If
End If
End Sub


Note: Access 97 and earlier do not have the AllForms collection. For those
versions, copy the IsLoaded() function from the Northwind sample database,
and use that instead.
 

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

Back
Top