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

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
68,115
Office Version
  1. 365
Platform
  1. Windows
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

GGladu

New Member
Joined
Jul 13, 2014
Messages
12
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

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
68,115
Office Version
  1. 365
Platform
  1. Windows
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,196,013
Messages
6,012,857
Members
441,735
Latest member
melastro

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
Top