Printing only first page of a report (1 Viewer)

alcide

New member
Local time
Yesterday, 21:16
Joined
Nov 18, 2005
Messages
5
I have a button on a form. Pushing the button starts printing a report containing the current record that was on the form.

This record has many fields, so that it prints about 4 pages of text.

It is only the first page that i want to be printed.

Code is like this:

Private Sub cmd_Controle1Druk_Click()
On Error GoTo Err_cmd_Controle1Druk_Click

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "rpt_Controle1"

stLinkCriteria = "[vld_Id]=" & Me![vld_Id1]


DoCmd.OpenReport stDocName, acPreview, stLinkCriteria


Exit_cmd_Controle1Druk_Click:
Exit Sub

Err_cmd_Controle1Druk_Click:
MsgBox Err.Description
Resume Exit_cmd_Controle1Druk_Click

End Sub
 

GUIDO22

Registered User.
Local time
Today, 05:16
Joined
Nov 2, 2003
Messages
515
DoCmd.SelectObject acReport, strReportName ' required to close the object
DoCmd.PrintOut acPages, 1, 1
 

MichealDon

Registered User.
Local time
Yesterday, 21:16
Joined
Nov 25, 2017
Messages
29
Hello everybody,
I have a command button on a form to print some reports in the same time. But some pages in some reports to be needed printing out for saving . For example :
+ With 4 reports in my database to be printed in the same time by command coding.
- Report 1 with 20 pages from page 1 to page 20
- Report 2 with 12 pages from page 1 to page 12
- Report 3 with 18 pages from page 1 to page 18
- Report 1 with 16 pages from page 1 to page 16
And now I want to print as below description :
- Print Report 1 : from page 1 to page 8 and page 15 to page 20.
- Print Report 2 : from page 1 to page 6 and page 9 to page 12.
- Print Report 1 : from page 1 to page 10 and page 13 to page 18.
- Print Report 1 : from page 1 to page 12 and page 15 to page 16.
Would you like to help me for doing this by coding .
Thank you very much.
MichealDon.
 
Last edited:

MichealDon

Registered User.
Local time
Yesterday, 21:16
Joined
Nov 25, 2017
Messages
29
Dear Gasman,
Thank you very much.
Best Regards,
MichealDon
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 00:16
Joined
Feb 19, 2002
Messages
43,223
The request to print ranges as you have defined is suspect at best. Are you sure you want to print specific pages? Wouldn't it be more likely that you want to choose what to print based on the data? So maybe you want to print data for department 12. Today that is on pages 8-11. Tomorrow it might be 9-12.
 

Users who are viewing this thread

Top Bottom