Preview report before printing (1 Viewer)


Registered User.
Local time
Today, 11:58
Dec 26, 2009
I am trying to preview a report before printing which uses the following code for printing;

‘= = = Old Code = = =
Private Sub cmdPrint_Click()
Dim repFilter As String
If IsNull(Me.cmbFindAccountYearMOR) = True Then
Exit Sub
repFilter = "[AccountingYear] = '" & CStr(cmbFindAccountYearMOR) & "'"
End If
DoCmd.OpenReport repName, acViewNormal, , repFilter
DoCmd.OpenReport stDocName, acPreview
End Sub
‘ = = =
I normally use the code below to preview our reports prior to printing.

‘ = = = Preview Code = = =
DoCmd.OpenReport stDocName, acPreview
‘= = =
Could I please have assistance in how to adjust the Old Code so that we can preview the print before printing?
Thank You
The only way I could handle this was to build a custom ribbon to be active for report in print preview and user clicks Print from the ribbon.

You have been posting here long enough to know code should be posted between CODE tags.
All of my print options are from a [Print] button on every operations form that calls my <Print Options> Form. You simply pass the report name as a parameter to <Print Options>
From that the user decides what they want to do by clicking a button as follows:

Export Options
[Export Selected Option]

Forcing a user to a preview before printing may well be irritating if they only want to print. Plus from <Print Options> you can give the user the option of printing multiple copies of the report. If they wanted to print ten copies in your proposal they'd need to preview every one first.
Yes, I do something similar. If user chooses Preview, then the custom ribbon is active so they can still opt for Print. This is needed because I have disabled interactive features such as standard ribbon, navigation pane, shortcut menus, etc.
I always give the user the option to preview or print. That allows him to preview WITHOUT printing. I like trees. I don't print reports unless they actually need to be printed. So, if the user previews the report, and he decides to print also, he either prints manually or closes the preview and changes the option to print and clicks again. I haven't tried to give him the option to print a report where all the menus are disabled. If you preview using report view, you can easily add a "live" button to the report to print from the preview and than close the preview. But the important concept is that the user needs to be able to preview WITHOUT printing.
Maybe you can use:
DoCmd.RunCommand acCmdPrintPreview

Users who are viewing this thread

Top Bottom