Suppress page header if...

M

Michael Walsh

On the report I have written, there is a page header that
shows a key or legend for the information in the detail.
Therefore it looks kind of bad to show this on a page
where this is no detail shown like on pages that are all
section footers or report footers.

I want to write some code that tells the report
(specifically the page header) not to show up or print
when there is no detail on the page, but I don't know
where to begin other than it would probably be an IIf
statement. How can I identify or quantify whether or not
detail shows up on a report page?
 
S

SA

Mike:

Try in the On Print event of the page header:

If me.Page = Me.Pages then
Me.PrintSection = False
End if

Note that for this to work you normally have to have a control on the report
that references the pages property in some form or fashion, although it can
be invisible if you don't want it displayed.
 
M

Michael Walsh

I wasn't sure where you were going with this as I don't
understand what's meant by if page = pages, but I tried it
anyway and it didn't do what I was trying to do. To be
clear, on the report page(s) where there is no detail
shown I want to suppress the page header on only those
pages.
 
S

SA

Mike:

Sorry, I guess I was thinking that this only occured on the last page of
your report, where certainly the current page number = the total page
numbers.

The problem that you are going to have is that its very difficult to
determine if a detail line will print on the page when you are formatting
the page header which occurs before the detail section is formatted. You
could in each group header, open a recordset to count the number of detail
records for that group setting it into a module level variable, and then use
a module counter to increment as each detail line is printed, zeroing out
the counter when the group footer arrives, and last in the page header
evaluate if totaldetails = countdetails (i.e. all the details for that group
have been printed) and if so then Me.PrintSection = False.

HTH
 
M

Michael Walsh

Thanks for your help... what I really need is a detail
header rather than a page header, something that would
only print each time detail is printed. Would something
like that be easier and is that even possible?
 

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