Two labels, two printers, a one-step process.

mafhobb

Registered User.
Local time
Today, 03:43
Joined
Feb 28, 2006
Messages
1,249
Hello,

I am working on a database that will be used to print out labels. There are two reports (small, large), which are basically the two labels I need to print. The smaller labels needs to be printed to a Zebra GK 420t printer while the larger label needs to be printed to a Zebra 105sl printer.

Both printers are installed in the windows system.

I want to have a button for each label so that the user can click on one or the other and what I need is for the correct report (label) to be printed in the correct printer without the user having to choose it. Basically a one-step process for each label.

What would be the code for that? Specifically, how to programatically tell a report to print in a specific printer, without any messages coming up?

Thanks

mafhobb
 
When you save each report you will have the option to save the report to print on the default printer or to a specific printer (by choosing from the list of windows printer drivers installed on the PC).

Choosing a specific printer should solve the issue of Access showing users messages asking to select a printer.
 
I see...given that I am offsite and that I do not have the printers installed on my computer, is there any way to programatically tell the report to print on that printer no matter what?

mafhobb
 
I see...given that I am offsite and that I do not have the printers installed on my computer, is there any way to programatically tell the report to print on that printer no matter what?

mafhobb

Not sure about controlling programatically.

You could install/setup the printer drivers on your PC (development PC) like they would be on the end user's computer and then save the reports to use those printer drivers.

Otherwise I think you will need to modify the reports on the end user's PC and save to use the desired printers.

Make sure you save a backup copy of the DB after making this change :)
 
All right, so I have a small test database here which almost does what I need.

When clicking the print button, the report opens and the print dialog opens for the user to basically say "OK". The correct printer with the correct settings is already selected.

1- How can I do it so the user does not get asked to say "OK" so the report prints automatically
2- Can it be done so the the report does not even show up on the screen?

mafhobb
 

Attachments

All right, so I have a small test database here which almost does what I need.

When clicking the print button, the report opens and the print dialog opens for the user to basically say "OK". The correct printer with the correct settings is already selected.

1- How can I do it so the user does not get asked to say "OK" so the report prints automatically
2- Can it be done so the the report does not even show up on the screen?

mafhobb

Sorry, but I'm still using Access 2003.

Can you post the code you use to print the report?

EDIT 1: VBA command to print a report is below

DoCmd.OpenReport "MyReport", acViewNormal

To control printer via code see answer from Andrew Fergus at link below

http://www.mrexcel.com/forum/micros...sic-applications-print-docmd.html#post1199819

EDIT 2: alternate VBA command below

OR as posted by Alex Dybenko, the following method which does not require the report to be in Preview mode.

Code:
DoCmd.SelectObject acReport, "rptCustomers", True
[B]'This prints out two copies of the report[/B]
DoCmd.PrintOut , , , , 2

http://access.mvps.org/access/reports/rpt0001.htm
 
Last edited:
Ajvol01, I used a Macro created by the "create a button" wizard. My VBA skills are limited.

mafhobb
 
Ajvol01, I used a Macro created by the "create a button" wizard. My VBA skills are limited.

mafhobb

Most DoCmd functions in Access VBA are also available to be used in Access macros.

Take a look at the 2 screen shots below that show the SelectObject and PrintOut functions in a macro.

I hope this helps.

attachment.php


attachment.php
 

Attachments

  • Macro_SelectObject.png
    Macro_SelectObject.png
    66.8 KB · Views: 221
  • Macro_PrintOut.png
    Macro_PrintOut.png
    55.2 KB · Views: 211

Users who are viewing this thread

Back
Top Bottom