turn pagebreak on or off


V

vtj

I have a pagebreak control in a report footer. In reviewing entries to this
group, it appears that if the control is made .visible = false that it will
turn off the page break. This does not happen. If the control is in the
footer, I can find nothing that will cause it not to happen. I tried
modifying a command, "pagebreak.visible = (Me.Page Mod 2 = 0)" that I saw in
the entries that will force a page break by changing the last 0 to 1 or -1
but neither stopped the break from happening. The groupfooter that I have
the pagebreak in includes some lines that are made invisible so they do not
print. I tried making the groupfooter invisible also thinking that if the
whole footer were invisible the pagebreak would also be invisible. That
didn't work either. It is obvious that I don't know how the pagebreak works
so any help would certainly be appreciated. I am trying to use a number of
different variables to set the pagebreak on or off depending on the value of
those variables. I was hoping that I could use a statement like "If variable
= value then pagebreak.visible = False else pagebreak.visible = True." This
is being used on a long report that needs to be paged at various points not
related to how much information detail has been or is to be printed. I am
using Access 2007 with a 2000 program running XP.
 
Ad

Advertisements

C

Clifford Bass

Hi vtj,

Not sure if this will apply for you, but it may get you headed in the
right direction. I have a report where each person's data (i.e. one detail
row) appears on multiple pages and can grow and shrink. Since it can easily
get into the thousands of pages, I designed it to work with duplexing, adding
blank pages when needed so that no one's information starts on the back side
of someone else's set. In my case, each person's set of pages are numbered
starting with 1. I have it sorted by last name, first name, ..., ID. I made
a group header and footer at the ID level. At the bottom of the ID group
footer I put a page break. Here are my group header and footer on format
event subroutines.

Private Sub GroupFooterID_Format(Cancel As Integer, FormatCount As Integer)

PageBreakID.Visible = (Page Mod 2 = 1)

End Sub

Private Sub GroupHeaderID_Format(Cancel As Integer, FormatCount As Integer)

Page = 1
PageBreakID.Visible = False

End Sub

Sometimes pre-setting the visibility of the page break in a header
seems to make a difference.

Hope that helps,

Clifford Bass
 
V

vtj

Your last comment about putting it in the header works - THANKS. I don't why
it should make a difference if it is in a header or footer but as long as it
works I won't spend more time on it. If you have time can you tell me what
(Page Mod 2 = 1) actually means? And maybe what other numbers would work for
what purpose? Thanks
 
C

Clifford Bass

Hi vtj,

Conditional page breaks have been something that I have struggled with
more than once. It would be nice if Microsoft would make that ability a
feature.

Not entirely sure what part of (Page Mod 2 = 1) you are asking about,
so I will expand on it in a couple of ways, both for you and others. It
could more clearly be written as ((Page Mod 2) = 1). It breaks down as
follows: Page Mod 2 is calculated first due to rules of computation order,
returning the remainder of the current page number divided by two (Mod is
short for modulus). The result is then compared to one to see if an extra
page is needed. When the result is zero it is on an even page. When it is
one it is on an odd page.

PageBreakID.Visible = (Page Mod 2 = 1) is a shorter way of doing the
following:

If Page Mod 2 = 1 Then
PageBreakID.Visible = True
Else
PageBreakID.Visible = False
End If

Since PageBreakID.Visible is a boolean and the condition Page Mod 2 = 1
results in a boolean you can just assign it directly. It may work without
the parantheses, but could be confusing to the reader so I always use the
parantheses.

Did that answer your question?

Clifford Bass
 
Ad

Advertisements

V

vtj

I really appreciate your explaination! I now understand what is happening.
Thank you so much for taking the extra time.
 

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