controlling print range from code on report

A

Andy G

Is it possible to control my 'Print Range' from code on a report? Example:
I want to print the first two pages of a four page report. Print Range:
From 1 To 2.

So right before the line below could I put a line to do this.

DoCmd.openReport rptName, acViewNormal, , , acWindowNormal
 
F

fredg

Is it possible to control my 'Print Range' from code on a report? Example:
I want to print the first two pages of a four page report. Print Range:
From 1 To 2.

So right before the line below could I put a line to do this.

DoCmd.openReport rptName, acViewNormal, , , acWindowNormal

If you know in advance which pages you wish to print, there is no need
to actually open the Report.

In VBA help, look up the SelectObject and PrintOut methods.

Dim rptName as String
rptName = "MyReport"
DoCmd.SelectObject acReport, rptName, True
DoCmd.PrintOut acPages, 1, 2
 
Top