Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Print window 3

Status
Not open for further replies.

ailyn

Programmer
Sep 15, 2005
108
0
0
BE
I'm trying to open the print option on a repport. I want to allow the user to choose the printer so I just need the print window to open when the report opens. How can I do this? PrintOut prints it directly and that is not what I need.
 
Thaaanks, to you two. the thing is finished. i still have to filter an error that seems to loop but it works!

Here is what I did Zameer, the option from the site you gave me is very interesting but not for what I want, I prefer direct buttons from the form because my users want it easy:

This is the module:

Function OpenBlowersAll()
Dim ReportName As String
ReportName = "Blowers"

If MsgBox("Print now?", vbYesNo) = vbYes Then
DoCmd.OpenReport ReportName, acViewPreview, "MOTOR All"
DoEvents
DoCmd.RunCommand acCmdPrint
End If

End Function

and this is the code for the button in the form:

Private Sub RepBlowers_Click()
On Error GoTo Err_RepBlowers_Click

Call OpenBlowersAll

Exit_RepBlowers_Click:
Exit Sub

Err_RepBlowers_Click:
MsgBox Err.Description
Resume Err_RepBlowers_Click

End Sub

If the user click on 'Yes' for printing but then cancels the printing on the printers window, the error window keeps appearing, I don't know why because this is how I've been filtering all my other errors and they always work. any idea why this may be happening?
 
You have to write an error handler in OpenBlowersAll too.
Note: OpenBlowersAll should be a Sub instead of a function as it returns no value.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thaanks! It's finally completely solved. Thanks for the tip Zameer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top