Preview instaed of Print

Z

Zoe

I have this code which works perfectly to print the reports but I want to
preview them:

Private Sub cmdBkAgtReports_Click()
Dim intItem As Integer
Dim lbo As ListBox
Set lbo = Me.lboPkAgt
For intItem = 0 To lbo.ListCount - 1
Debug.Print lbo.ItemData(intItem)
DoCmd.OpenReport "Monthly Total - Multiple Agents" _
, , , "BkAgt=""" & lbo.ItemData(intItem) & """"
Next

End Sub

Help is appreciated!
 
F

fredg

I have this code which works perfectly to print the reports but I want to
preview them:

Private Sub cmdBkAgtReports_Click()
Dim intItem As Integer
Dim lbo As ListBox
Set lbo = Me.lboPkAgt
For intItem = 0 To lbo.ListCount - 1
Debug.Print lbo.ItemData(intItem)
DoCmd.OpenReport "Monthly Total - Multiple Agents" _
, , , "BkAgt=""" & lbo.ItemData(intItem) & """"
Next

End Sub

Help is appreciated!

Look up the arguments of the OpenReport method in VBA help.
 
Z

Zoe

Hi Fred,

I've looked in VBA Help. I can't figure out how to inset acViewPreview in
this or how to override the default of acViewNormal.

:(
 
D

Douglas J. Steele

DoCmd.OpenReport "Monthly Total - Multiple Agents" _
,acViewPreview , , "BkAgt=""" & lbo.ItemData(intItem) & """"
 
Z

Zoe

Hi Douglas,

That works! BUT it only previews the first report in the series. Before
(when it was printing) it printed the report for the first agent and
continued thru the list box, creating a report for each agent in the list
box. How do I restore that functionality and still keep it as a preview?

Thanks so much!
 
R

Rick Brandt

Zoe said:
Hi Douglas,

That works! BUT it only previews the first report in the series.
Before (when it was printing) it printed the report for the first
agent and continued thru the list box, creating a report for each
agent in the list box. How do I restore that functionality and still
keep it as a preview?

You can't. A single report cannot be brought up in preview mode more than
one time simultaneously.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top