Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

conditional page header ruins page numbering

Status
Not open for further replies.

evilmousse

Programmer
Apr 15, 2003
85
US
I've finally succeeded in conditionally displaying the
page header for a report, but now Access sometimes
incorrectly estimates the total number of pages in the
report, and i get errors like "page 163 of 162".

Here's what the report is like so far:

The group1 header is the most common top of each page. It
displays group summary info, and the column labels for
the detail information that follows. the detail section,
if it overflows onto the next page, needs those column
labels displayed above them again. I wish page
head/footers were within group head/footers instead of
the other way around. So, I use the page header to
redisplay the detail column headers. This is the only
time pageheader gets displayed, when a detail overflows a
single page.

Here's how I accomplished this:

Private printheader As Boolean

Private Sub Detail_Print(Cancel As Integer, PrintCount As
Integer)
If (printheader = False) Then printheader = True
End Sub

Private Sub GroupFooter1_Format(Cancel As Integer,
FormatCount As Integer)
printheader = False
End Sub

Private Sub PageHeaderSection_Format(Cancel As Integer,
FormatCount As Integer)
If printheader Then
[Reports]![mandpipeline].Section
(acPageHeader).Visible = True
Else
[Reports]![mandpipeline].Section
(acPageHeader).Visible = False
End If
End Sub


The logic being, if a detail was the last thing
printed, the pageheader should be visible. if a group
footer is the last thing printed, the next page will
begin with a new group and not need the pageheader.
Now, everything works with the displaying, the headers
show at the right time and all, but unfortunately access
misestimates the overall length of the report.

Here's what I know so far:
Access does not fire the same events between 2 cases:
1) the user uses the next page button 50 times to get to
page 50
2) the user types "50" into the pagecontrol to jump to
page 50

Access fires GroupFooter1_Format a buttload of times when
the report is first opened, then a mere one or two times
when each page is cycled.

Access will fire the Report_Page() only once during a
jump from page 1 to 50 (ordinarily once per page),
whereas GroupFooter1_Format will be fired an appropriate
number of times.

There are some other things going on in the report,
namely the conditional resizing of the group header, but
I'm fairly sure the conditional display of the pageheader
that's the problem, because the problem disappears when i
remove the conditional logic on it and either always
display it or always not.


So, my guess right now is that Access chooses to do an
estimate of the page numbers instead of articulating out
the report to see for sure. I'm at a loss as for what to
do about this. I don't want to choose between correct
column headers and correct page numbers.

Thanks in advance for any help.

-gregg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top