Force a page break in code

B

Bill

I need to force a page break in the Detail_OnFormat
Event when a value changes. How do I do that?

Thanks,
Bill
 
R

Rick Brandt

Bill said:
I need to force a page break in the Detail_OnFormat
Event when a value changes. How do I do that?

Thanks,
Bill

Insert a PageBreak control from the ToolBox bar at the desired location. Even
though such a control is never "visible" other than in design view they do still
have a Visible property. That property effectively turns on and off the
PageBreak so you can minipulate that in your code.
 
M

Marshall Barton

Bill said:
I need to force a page break in the Detail_OnFormat
Event when a value changes. How do I do that?


It's better to create a group on the field with the value.
then you can use the ForceNewPage property on the group
header section.
 
B

Bill

Marsh,
I can group on the field and I see the ForceNewPage
property, but it's not clear what event to use to
enable the ForceNewPage property ONLY the first
time the group field changes. I.e., I don't want a page
break to be enabled the first time the group header
prints, only on subsequent encounters.
Bill
 
M

Marshall Barton

I'm not sure I understand what you are saying. With the
group header section's ForceNewPage property set to Before
Section, the first instance of the group header will not
eject a new page unless there is a visible report header. If
you want the report header on the same page as the first
group, it seems inconsistent with starting each group on its
own page.

If that is what you want, try setting the property to None
in design view and reset it in the header section's Print
event procedure:
Me.Section(5).ForceNewPage = 1
 
B

Bill

AH! You wrote:

"With the group header section's ForceNewPage property
set to Before Section, the first instance of the group header
will not eject a new page unless there is a visible report header."

Which is exactly what I was trying to accomplish.
Thanks,
Bill


Marshall Barton said:
I'm not sure I understand what you are saying. With the
group header section's ForceNewPage property set to Before
Section, the first instance of the group header will not
eject a new page unless there is a visible report header. If
you want the report header on the same page as the first
group, it seems inconsistent with starting each group on its
own page.

If that is what you want, try setting the property to None
in design view and reset it in the header section's Print
event procedure:
Me.Section(5).ForceNewPage = 1
--
Marsh
MVP [MS Access]

I can group on the field and I see the ForceNewPage
property, but it's not clear what event to use to
enable the ForceNewPage property ONLY the first
time the group field changes. I.e., I don't want a page
break to be enabled the first time the group header
prints, only on subsequent encounters.


"Marshall Barton" wrote
 
C

croy

I'm not sure I understand what you are saying. With the
group header section's ForceNewPage property set to Before
Section, the first instance of the group header will not
eject a new page unless there is a visible report header.


I'm not the OP, but the above *seems* backwards to me.
Wouldn't it be "if there is a visible report header"? Or is
that just the way I'd *like* it to be? ;-0
If you want the report header on the same page as the first
group, it seems inconsistent with starting each group on its
own page.


Not to me--I think the first group, under the report title
and such, which don't take up much room on the page, and
then breaking pages for each group after that is quite
reasonable. Or have I misinterpreted?

If that is what you want, try setting the property to None
in design view and reset it in the header section's Print
event procedure:
Me.Section(5).ForceNewPage = 1


Nifty trick! Thanks.
 

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