treva26
03-21-2010, 11:05 PM
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
'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
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
'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