Want button to open printer preview

G

Guest

Hello - Thank you in advance.

I have built a simple "print report" button on a form using the wizard.
Clicking the button immediately sends report to printer. On this site I have
found how to add a preview feature.... but it's an Access preview screen.

Is there any way that I can program that button to open my normal printer
preview window - where a user can choose to change the quality of the
printing, number of copies....etc.??

Thanks again.
 
A

Allen Browne

After you open the report in preview mode, you can open the print dialog
too:
DoCmd.OpenReport "Report1", acViewPreview
RunCommand acCmdPrint
 
G

Guest

Oh Allen! This is Great! Now I feel I don't even need the Access preview,
since I can choose whether to preview from the normal printer window. So, I
tried to be smart and take away the "acViewPreview" part of the code... This
resulted in opening the printer window, just fine, BUT, it starts printing
right away without waiting for me to click the OK print button. Here's the
code I have now... How do I change it so that it opens the printer dialogue
box ONLY without starting to print?

stDocName = "PrintInterview"
DoCmd.OpenReport stDocName
RunCommand acCmdPrint

THANKS SO MUCH
 
A

Allen Browne

My understanding is that the print dialog needs a context.
The preview gives it the context you want.
I'm not sure what alternative you would choose.
 
G

Guest

Hmmm. OK. Not sure I understand.

What I would like is for the command button to open my printer dialogue
window and stop there. Then I could proceed with printing the report the way
I needed to from the printer dialogue window - for example, if I needed a
rough copy, I'd choose draft form...if I wanted the best copy I would choose
best...if I wanted gray scale vs. color..I'd choose that... you know, the
normal stuff one chooses from the printer.... I don't want to create buttons
for all these options... I want the user to use whatever printer dialogue
window they're used to...
The code below shows me the printer dialogue window just fine, but starts
printing right away, so I can't make any choices...(which makes seeing the
window useless!)

So, anyway, if you say this is not possible....that's OK....and thanks for
your response!!
 
A

Allen Browne

Ah: we didn't specify to open in preview:

DoCmd.OpenReport stDocName, acViewPreview
RunCommand acCmdPrint
 
A

Allen Browne

No, actually the preview part was suggested, but not what you want.

If you open the print dialog without being in preview, *what* is to be
printed? The active form? That's the point of opening the preview before
hand.

In Access 2002 and later, you can programmatically set the properties of the
Printer object, and it will apply until you change it. Perhaps you can
design a form that looks something like the print dialog, and respond by
setting the properties of the Printer, and then fire off the report.
 
G

Guest

Allen - thanks for continuing with this...helps me learn: I'm including my
whole code on this button below. I'm sure I haven't explained myself well.
I made a report (Printinterview) that contains all the fields in my form.
The button refers to that report. The code below right now just fires of to
the printer without any previews...
___________________________
Private Sub PrintButton_Click()
Dim strWhere As String

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[ID] = " & Me.[ID]
DoCmd.OpenReport "Printinterview", acViewNormal, strWhere
End If
End Sub
________________________________________
 
A

Allen Browne

Change:
acViewNormal
to
acViewPreview

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Stilla said:
Allen - thanks for continuing with this...helps me learn: I'm including
my
whole code on this button below. I'm sure I haven't explained myself
well.
I made a report (Printinterview) that contains all the fields in my form.
The button refers to that report. The code below right now just fires of
to
the printer without any previews...
___________________________
Private Sub PrintButton_Click()
Dim strWhere As String

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[ID] = " & Me.[ID]
DoCmd.OpenReport "Printinterview", acViewNormal, strWhere
End If
End Sub
________________________________________
Allen Browne said:
No, actually the preview part was suggested, but not what you want.

If you open the print dialog without being in preview, *what* is to be
printed? The active form? That's the point of opening the preview before
hand.

In Access 2002 and later, you can programmatically set the properties of
the
Printer object, and it will apply until you change it. Perhaps you can
design a form that looks something like the print dialog, and respond by
setting the properties of the Printer, and then fire off the report.
 

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

Top