Managing Headers

P

Patrik

How does Access work for his headers ? It is all yes or all no, builds
them one at a time ????

Since I print both sides of paper, for every group, I add a page if
total is odd so every group starts on even page. But Access counts that
extra page, so page I get page 1 of 4 instead of 1 of 3. And it also
prints group header and page footer on that extra page.

I fixed the page problem.

But I cannot fix the group header and page footer. I tried this in my
page footer :

If GrpArrayPage(Me.Page) < TotalPages Then
Me.footer1.Visible = True
Else
Me.footer1.Visible = False
End If

I follow it using the debugger and it seems perfect but, somehow I get
a page footer only on page 2 for the first group then on page 2 and 3
for the second group ???????????????

The same logic in group header gives me the header on page 1 but not on
any other page. Same if I try it on print event. Tried multiple
possibilities, I just don't get how Acces builds the report.

Thank you for much appreciated help
 
S

salutbonjour100

You should start to read Access for Dummies so much your question is
very stupide. Read MS ACCESS Help for answer your question.

TheBoss
 
S

salutbonjour100

Scuse me, your question is very not stupide, I'am not able to make
that...anybody can't help us?
 
M

Marshall Barton

Patrik said:
How does Access work for his headers ? It is all yes or all no, builds
them one at a time ????

Since I print both sides of paper, for every group, I add a page if
total is odd so every group starts on even page. But Access counts that
extra page, so page I get page 1 of 4 instead of 1 of 3. And it also
prints group header and page footer on that extra page.

I fixed the page problem.

But I cannot fix the group header and page footer. I tried this in my
page footer :

If GrpArrayPage(Me.Page) < TotalPages Then
Me.footer1.Visible = True
Else
Me.footer1.Visible = False
End If

I follow it using the debugger and it seems perfect but, somehow I get
a page footer only on page 2 for the first group then on page 2 and 3
for the second group ???????????????

The same logic in group header gives me the header on page 1 but not on
any other page. Same if I try it on print event. Tried multiple
possibilities, I just don't get how Acces builds the report.


This situation is not simple. Generally Access processes
each section one at a time, first its Format event then its
Print event. When a new page situation is encountered,
either because there is no more space on a page or because
you did something (PageBreak control, ForceNewPage property,
etc). The page footer section is processed (with the data
from the last detail on the page still available). Then the
Page event is fired, but I don't think you are using this
event.

Next, the page header section is processed (with the data in
the first detail on the new page available). If a Group
header section's RepeatSection property is set to Yes, that
group header is then processed again. Finally, the next
detail section is processed.

To get a blank even numbered page when needed to start a new
group on an odd numbered page, add a PageBreak control named
pgBreak at the very bottom of the group footer section and
use code in the group footer's Format event to make it
visible or not depending on the the page number:

If (Me.Page Mod 2) = 1 Then
Me.pgBreak.Visible = True
Me.Section(3).Visible = False 'Hide next page header
Else
Me.pgBreak.Visible = False
End If

Then use code in the page header's Format event to make the
Page Footer visible or not depending on the page header's
visibility:
Me.Section(4).Visible = Me.Section(3).Visible

Use the page footer Format event to the page header's
visibility when needed:

If (Me.Page Mod 2) = 0 Then
Me.Section(3).Visible = True
End If

Set the Group header section's ForceNewPage property to
Before Section to get each group to start on a new page.

Because you are using a text box with =Pages, the report
will be processed twice (once to calculate the value of
Pages and again to display it), so the visibility of the
page header must be initialized in the report header
section's Format event:

Me.Section(3).Visible = True
 
P

Patrik

Thank You Marsh,

It is indeed complicated, I will try what you suggest. In the meantime,
I just 'solved' my problem manually. From the toolbox, I added a
rectangle named 'HideGroup' on top of the groupheader and footer. Using
the same exact code, I make it visible or not and it works. So it works
if I refer to a rectangle but nor directly to the GroupHeader or
Footer.

But I will try your suggestion for a 'cleaner' code

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