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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Report-user choses printer-no print dialog-no preview

Status
Not open for further replies.

TommieB

Programmer
Dec 12, 2001
34
US
I am currently working with bar codes. I have created several reports for the different size barcodes. The user needs to be able to select the printer (barcode or default) and have the report print to that printer without the report opening in preview. Therefore the user will not have access to the printer dialog box. When the user selects the number of labels, if the printer is barcode it will print on roll labels, if the printer is any other printer the number of labels will print on 3 across label paper. I can control the copies and resolution through .printall, but can't figure out a way to let the user select the printer. I also, at this point, open the report, printall, close the report to keep the user from seeing the preview. Can I print without it ever opening?
 
Dear TommieB,
See the following thread it may be of help
thread703-175460
I can't navigate there via that link so I will copy and paste it here:

This is the code I use for printing out an invoice where the HireJobID (the primary key) is the same as that on the form I am printing from.
Code:
Private Sub cmdPrintHireInvoice_Click()
Me.Refresh
Dim strRptName As String
Dim strWhere As String
    strRptName = "HireInvoice"
    strWhere = "[HireJobID]=" & Me!HireJobID
    DoCmd.OpenReport strRptName, acPrintAll, , strWhere

End Sub
Obviously you will have to replace my report and field names with your own.
Good luck and I have to admit I got this code from someone here so, thank you whoever it was.
Regards Jim
;-)
 
Thanks, but I was basically already doing that. It is selecting the printer that is giving me fits. Oh well, I just worked around it. Here is what I did for anyone who might need to do this later. It allows the user to see the report, but brings the print dialog up in front where they can choose a printer and number of copies.

on the Print button click event:

Dim stDocName As String
stDocName = "Barcode4x1"
DoCmd.OpenReport stDocName, acViewPreview
DoEvents
DoCmd.RunCommand acCmdPrint
DoCmd.Close acReport, "Barcode4x1"
 
Sorry, I should have read what you said in the post
Good luck.
Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top