Erratic print of header different from print preview

V

vtj

I am trying to use the .visible property to print some heading information on
the first 20 pages of a report and not print a portion of the header after
that. I have lines such as this 'If (pagenumber% > 22) Then Label150.Visible
= False Else Label150.Visible = True' in the 'Private Sub
PageHeader0_Format(Cancel As Integer, FormatCount As Integer)' code. I have
tried using a counter adding 1 to itself each time a page footer is run, and
also setting a value = to a number and then testing that value. When first
viewed in print preview each of the methods seems to work. However if
printed, that portion of the heading is gone from all pages. If you scroll
through the pages in print preview, some will have the information and others
won't. It seems random in that the header information may be on the first
few pages, then gone for a few pages, then back again. It seems to be
different pages each time the file is opened. Any clue as to what is
happening and what can be done to make it work consistantly would be greatly
appreciated. At a minimum it would be nice to know why what you see on the
screen in print preview is not what you necessarily get at the printer. I am
running Access 2007 on a Windows XP box.
 
J

John Spencer

What is happening is that your counter is not reliable. It is probably only
incrementing when you move to a page (and perhaps everytime you move to the
page) and as a guess you are not resetting it to zero when you start go to
print from print preview

Why not use the built in Page property? You can show/hide various controls
(correctly) with a line like:

Label150.Visible = Me.Page > 21


John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
V

vtj

Thank you very much. Works every time now.

John Spencer said:
What is happening is that your counter is not reliable. It is probably only
incrementing when you move to a page (and perhaps everytime you move to the
page) and as a guess you are not resetting it to zero when you start go to
print from print preview

Why not use the built in Page property? You can show/hide various controls
(correctly) with a line like:

Label150.Visible = Me.Page > 21


John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 

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