Help! I need to export a report in PDF format but the trick is I only need to export the first page only. Here is what I have and it works fine with the exception of the output. It outputs all the pages and I only need the first page. Could page parameters be used somewhere in this string?
On Error GoTo Err_Command66_Click
Dim Response1 As Integer
Dim intCopies As Integer
Dim StrReport1 As String
Dim StrReport2 As String
StrReport1 = "Employee_Summary_1"
StrReport2 = "Employee_Summary_2"
Response1 = MsgBox("Would the print in color ?" _
& vbCr & vbCr & " Press ""Yes"" to print in Color" _
& vbCr & " Press ""No"" to print in Grayscale", _
vbYesNoCancel + vbQuestion, "Print Options")
If Response1 = vbYes Then
intCopies = InputBox("Please enter number of copies", "Copies")
DoCmd.OpenReport StrReport1, acPreview
DoCmd.PrintOut acPages, 1, 1, , intCopies, True
DoCmd.Close acReport, "Employee_Summary_1"
DoCmd.OutputTo acOutputReport, StrReport1, acFormatPDF, "c:\temp\" & StrReport1 & ".pdf"
ElseIf Response1 = vbNo Then
intCopies = InputBox("Please enter number of copies", "Copies")
DoCmd.OpenReport StrReport2, acPreview
DoCmd.PrintOut acPages, 1, 1, , intCopies, True
DoCmd.Close acReport, "Employee_Summary_2"
DoCmd.OutputTo acOutputReport, StrReport2, acFormatPDF, "c:\temp\" & StrReport2 & ".pdf"
Exit_Command66_Click:
Exit Sub
Err_Command66_Click:
MsgBox Err.Description
Resume Exit_Command66_Click
End If
On Error GoTo Err_Command66_Click
Dim Response1 As Integer
Dim intCopies As Integer
Dim StrReport1 As String
Dim StrReport2 As String
StrReport1 = "Employee_Summary_1"
StrReport2 = "Employee_Summary_2"
Response1 = MsgBox("Would the print in color ?" _
& vbCr & vbCr & " Press ""Yes"" to print in Color" _
& vbCr & " Press ""No"" to print in Grayscale", _
vbYesNoCancel + vbQuestion, "Print Options")
If Response1 = vbYes Then
intCopies = InputBox("Please enter number of copies", "Copies")
DoCmd.OpenReport StrReport1, acPreview
DoCmd.PrintOut acPages, 1, 1, , intCopies, True
DoCmd.Close acReport, "Employee_Summary_1"
DoCmd.OutputTo acOutputReport, StrReport1, acFormatPDF, "c:\temp\" & StrReport1 & ".pdf"
ElseIf Response1 = vbNo Then
intCopies = InputBox("Please enter number of copies", "Copies")
DoCmd.OpenReport StrReport2, acPreview
DoCmd.PrintOut acPages, 1, 1, , intCopies, True
DoCmd.Close acReport, "Employee_Summary_2"
DoCmd.OutputTo acOutputReport, StrReport2, acFormatPDF, "c:\temp\" & StrReport2 & ".pdf"
Exit_Command66_Click:
Exit Sub
Err_Command66_Click:
MsgBox Err.Description
Resume Exit_Command66_Click
End If