Preview report before printing (1 Viewer)

access2010

Registered User.
Local time
Yesterday, 23:24
Joined
Dec 26, 2009
Messages
1,021
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
Else
repFilter = "[AccountingYear] = '" & CStr(cmbFindAccountYearMOR) & "'"
End If
DoCmd.OpenReport repName, acViewNormal, , repFilter
DoCmd.OpenReport stDocName, acPreview
DoCmd.Maximize
End Sub
‘ = = =
I normally use the code below to preview our reports prior to printing.

‘ = = = Preview Code = = =
DoCmd.OpenReport stDocName, acPreview
DoCmd.Maximize
‘= = =
Could I please have assistance in how to adjust the Old Code so that we can preview the print before printing?
Thank You
Nicole
 

June7

AWF VIP
Local time
Yesterday, 22:24
Joined
Mar 9, 2014
Messages
5,471
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.
 

Cotswold

Active member
Local time
Today, 07:24
Joined
Dec 31, 2020
Messages
528
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:

[Print]
[Preview]
Export Options
* CSV
* EXCEL
* PDF
[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.
 

June7

AWF VIP
Local time
Yesterday, 22:24
Joined
Mar 9, 2014
Messages
5,471
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.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:24
Joined
Feb 19, 2002
Messages
43,275
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.
 

LarryE

Active member
Local time
Yesterday, 23:24
Joined
Aug 18, 2021
Messages
591
Maybe you can use:
DoCmd.RunCommand acCmdPrintPreview
 

Users who are viewing this thread

Top Bottom