How do I get rid of blank pages in a report?

S

SIRSTEVE

Could anyone tell me how to have my report print only where there is data and
not to print out blank pages?

Thank you.
 
F

fredg

Could anyone tell me how to have my report print only where there is data and
not to print out blank pages?

Thank you.

Code the Report's OnNoData event:

MsgBox "There are no records to print."
Cancel = true

If you opened this report from an event on a form, this will raise
error 2501. Trap the error in the form's event that opened the report.

On Error GoTo Err_Handler
DoCmd.OpenReport "ReportName", acViewPreview

Exit_Sub:
Exit Sub
Err_Handler:
If Err = 2501 then
Else
MsgBox "Error #: " & Err.Number & " " & Err.Description
End If
Resume Exit_Sub
 
O

Olduke

SIRSTEVE said:
Could anyone tell me how to have my report print only where there is data and
not to print out blank pages?

Thank you.

Before you go to all the trouble of applying Fred's excellent response,
check your margins.
If you have your margins set to 1 inch on each side and your report is 6 3/4
inches wide, you're going to get blank pages.
 
L

Larry Linson

SIRSTEVE said:
Could anyone tell me how to have my report print only
where there is data and not to print out blank pages?

To expand on Oldduke's reply, first you have to determine why you are
getting blank pages, and then you can try to avoid them.

fredg's reply is correct when there is no data to be printed for the whole
report.

Oldduke's reply is correct if you have a body and margins which together
exceed the width of the paper.

If, on the other hand, you have some fields of information that are empty,
but you are still printing the space for that information, you should check
Help on the Can Shrink property for Controls and Report Sections.

Or, if you gave us some details, it might turn out to be something else
entirely. (My Magic 8-Ball says, "Perhaps so." My cloudy crystal ball
vaguely promises "There is a stranger in your future." My psychic powers
are on vacation.) Remember, you have your data, tables, and report design
right in front of you, but we are completely dependent on what you write
here and this question is very similar to "My car is making a strange noise;
how do I stop it from doing that?".

Larry Linson
Microsoft Office Access MVP
 

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