breaking page

J

JIM.H.

Hello,
How can I put a page break when a filed in the detail
section hits a certain value. I need to break the page
before the record. I do not mean put a page break each
time the filed has a certain value, I mean break the page
just once before the field has certain value and list the
next records on the same page.
Thanks,
Jim.
 
L

Larry Linson

In the Format event of the Detail section, put code similar to this.

If Me!CategoryID = 4 Then
Me.Detail.ForceNewPage = 2 'Before Section, click F1 to see
Help
Else
Me.Detail.ForceNewPage = 0
End If

You will need to test on a value just less than the one which you want to
start a new page, because by the time this code is executed the current
rendering of the Detail Section is already past the point of
BeforePrintingSection, but not past the AfterPrintingSection.

This is from a simple report of the Categories Table of the Northwind
Traders sample Database, and Category 5 is the one that begins the new page,
regardless of whether you set the ForceNewPage value to 1 (Before Section)
or 2 (After Section). So it will be the _next_ record to be printed, not the
current one, that starts a new page.

Seems to me there was a trick in a previous version, maybe 2.0, using the
Insert Page Break Control and setting its Visible property, but I note that
in Access 2003, there is no Visible property on the Page Break Control.

Larry Linson
Microsoft Access MVP
 

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