Printing Reports

GGladu

New Member
Joined
Jul 13, 2014
Messages
12
In my application a report is printed but for some reason it ejects a blank page first. The code is pretty simple. Can anyone tell me why or how to stop it?

Code:
Private Sub cmdPrint_Click()
On Error GoTo Err_cmdPrint_Click
    Dim stDocName As String
    stDocName = "rptPrintData"
    DoCmd.OpenReport stDocName, acPreview
Exit_cmdPrint_Click:
    Exit Sub
Err_cmdPrint_Click:
    MsgBox Err.Description
    Resume Exit_cmdPrint_Click
    
End Sub
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
There is nothing in your code that would do that.
It would either be in the Report itself (maybe something like a Page Break at the top), or a Printer setting or Print Driver issue.
What happens if you Print the Report manually (without code)?
 
Upvote 0
There is nothing in your code that would do that.
It would either be in the Report itself (maybe something like a Page Break at the top), or a Printer setting or Print Driver issue.
What happens if you Print the Report manually (without code)?

Thanks but I changed the width of the page (from 7.6 to 7) and that took care of the problem
 
Upvote 0
Yes, that is a common cause. If the width of your page plus the size of the margins exceeds 8.5 inches, it will spill over to a second page.
So you either need to adjust the width, or the margins.
As you discovered, it had nothing to do with your VBA code (which was fine), but rather with the Report itself.
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top