Blank Page when no data

G

Guest

I have a report that lists data entry transactions. I want to print out a
checklist of possible errors for each batch entered. I put my checklist in
the Report Header section as a subreport with a page break afterit. When
there are possible errors, the checklist prints out just like I want but when
there are no errors I get a blank page before my listing. Is there some way
to print my checklist if there are errors without the blank page when there
aren't any error records?

TIA
Lynne
 
A

Allen Browne

Instead of setting the ForceNewPage property of the section, you could add a
Page Break control from the Toolbox, and toggle its Visible property in the
Format event, depending on whether the subreport has data.

This kind of thing:
Me.[PageBreak1].Visible = Me.[Sub1].Report.HasData
 
G

Guest

Allen Browne said:
Instead of setting the ForceNewPage property of the section, you could add a
Page Break control from the Toolbox, and toggle its Visible property in the
Format event, depending on whether the subreport has data.

This kind of thing:
Me.[PageBreak1].Visible = Me.[Sub1].Report.HasData

Ok. I put the code in the PageHeaderSection On Format event of my report and
it gives me the page breaks I want with no blank pages. Thank you so much.
The thing is - for some reason the Page header section of my subreport just
is not printing. It just skips over that section. Any ideas?
 
A

Allen Browne

You put it in a page header? I don't understand that.

The idea of toggling the Visible property of the page break control is to
force Access to give you a page break conditionally. But if it is formatting
a page header for you, then a page break has already been calculated?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Lorien2733 said:
Allen Browne said:
Instead of setting the ForceNewPage property of the section, you could
add a
Page Break control from the Toolbox, and toggle its Visible property in
the
Format event, depending on whether the subreport has data.

This kind of thing:
Me.[PageBreak1].Visible = Me.[Sub1].Report.HasData

Ok. I put the code in the PageHeaderSection On Format event of my report
and
it gives me the page breaks I want with no blank pages. Thank you so much.
The thing is - for some reason the Page header section of my subreport
just
is not printing. It just skips over that section. Any ideas?
 
G

Guest

Allen Browne said:
You put it in a page header? I don't understand that.

I said that wrong - what I meant was I put the code in the REPORT header.

Let me try to explain this again...
I have a report that prints a listing of transactions entered into my
payroll application. I wanted to add an additional page to the report that
would list any possible pay date duplications. Some pay date duplications may
be valid so someone has to double check the errors. The idea is to add kind
of like a "cover letter" to the report so that the user has to do the
research on their end and sign off on any kickouts. So I added the "cover
letter" as a SubForm(Sub1) in the ReportHeaderSection of the main report. The
initial problem was that when there were no errors I got a blank page where
the subreport would have been. I added the code you suggested in the OnFormat
event of the ReportHeaderSection of the main report and that took care of the
problem of the blank pages.
The problem now is that the PageHeader of the subform does not print. SUB1
has ReportHeader and footer and PageHeader and footer etc of its own. When I
display SUB1 by itself, the pageheader prints. But when I display the entire
report, everything comes out fine - the subreport prints, the pagebreaks are
where they should be - except for some reason the PageHeaderSection of SUB1
does NOT show up. All the other sections of the subreport and the main
report are there. The PageHeaderSection of the main report is fine. Just the
PageHeader of the subreport is missing. I have my column headings in this
section and the report doesn't look as nice if I move them somewhere else.
This is a small thing, I know, but it makes me crazy when I can't figure
these things out.

I appreciate your help, Allen.
Thanks
Lynne
 
A

Allen Browne

Well, I'm not surprised it doesn't work the report header either.

In the main report, put the subreport into a section of its own. You may
need to create another group header or footer in the Sorting And Grouping
dialog (View menu.) For example if you create a group footer on the primary
key field, it will occur for every record, and you now have a separate
footer for the subreport for every record.

Now, place the page break control in this section on the main report, and
set its Visible property in the section's Format event.
 

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