Multiple Print Previews of a report?

treva26

Registered User.
Local time
Yesterday, 16:02
Joined
Sep 19, 2007
Messages
113
I have a report that I want to run with various WHERE conditions.
There is no problem if the user wants to print the resulting reports, it just prints one at a time and closes it.
But what if the user wants to just view the reports?
Can I have multiple versions of a report open in Print Preview mode?

I am opening them from VBA.
lstRepCodes is a listbox of Sales Reps
WHERE1 is the WHERE conditions, before adding the Sales Rep condition

Code:
'if VIEW then
If Me.ActionCombo = "View" Then Action1 = acViewPreview

'if PRINT then
If Me.ActionCombo = "Print" Then Action1 = acViewNormal



'open/print reports
For Each RepCode1 In lstRepCodes.ItemsSelected

 WHERE2 = WHERE1 & " AND [Bradken Sales Rep]='" & lstRepCodes.Column(1, RepCode1) & "' "
 DoCmd.OpenReport Me.ReportName, Action1, , WHERE2

 'let it process
 DoEvents

 'close the report if in print mode
 If Me.ActionCombo = "Print" Then DoCmd.Close acReport, "SalesPerformanceReport"

Next RepCode1
 
AFAIK, You can only print preview a single instance of report.

The way I get around this is to create a snapshot of each version got he same report and open each version in the snapshot viewer all at the same time. This looks very close to print preview.

You coudl also do the same thing with PDFs.
 
AFAIK, You can only print preview a single instance of report.

The way I get around this is to create a snapshot of each version got he same report and open each version in the snapshot viewer all at the same time. This looks very close to print preview.

You coudl also do the same thing with PDFs.

Good thinking!
I exported them to Rich Text files.
I had to add a 1 second pause to give Access time to close the preview before trying to reopen it.

Here is my code now:
Code:
'open/print reports
For Each RepCode1 In lstRepCodes.ItemsSelected
 'set parameters
 WHERE2 = WHERE1 & " AND [Bradken Sales Rep]='" & lstRepCodes.Column(1, RepCode1) & "' "
 
 'IF VIEW.....
 If Me.ActionCombo = "View" Then
 'open preview
 DoCmd.OpenReport Me.ReportName, acViewPreview, , WHERE2
 'export to rtf and open it
 DoCmd.OutputTo acReport, Me.ReportName, acFormatRTF, "C:\WPB\" & lstRepCodes.Column(1, RepCode1) & ".rtf", True
 'close preview
 DoCmd.Close acReport, "SalesPerformanceReport"
 Pause (1) 'custom pause function, waits one secone for the preview to close
 End If
 
 'IF PRINT.....
 If Me.ActionCombo = "Print" Then
 'open and print
 DoCmd.OpenReport Me.ReportName, acViewNormal, , WHERE2
 'wait
 DoEvents 'let it process
 'close
 DoCmd.Close acReport, "SalesPerformanceReport"
 End If
 
Next RepCode1
 

Users who are viewing this thread

Back
Top Bottom