473,722 Members | 2,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Choose Printer for Report

Hello I have a report that needs to printed by a specific printer
rather than the computers default printer?
Is there a way to dynamically choose a specific printer to print a
report through VBA code?
I know that in the report's page setup you could choose a specific
printer to print from in the page setup but that is not enough for my
needs.
I need to be able to dynamically choose a printer through code.
Is there a way?
Any help will be highly apreciated.
Thanks,
gil

Nov 13 '05 #1
3 15036
What version of Access are you using? AccessXP lets you manipulate
printers from within code. If you have an earlier version, various
MVPs have code on their websites to do it.

Here's one... and it's from Ken Getz, so you know it works...

http://www.mvps.org/access/reports/rpt0009.htm

Nov 13 '05 #2
If you are using Access 2002 or 2003, you can set the Printer object before
opening the report. There's an example of how to have the report remember to
default to one of the user's printers (not just the developer's printers),
in this links:
Printer Selection Utility
at:
http://allenbrowne.com/AppPrintMgt.html

If you are using Access 2000 or 97, Albert Kallal has code to let you do
that. They are linked in the above article.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<gi*******@gmai l.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Hello I have a report that needs to printed by a specific printer
rather than the computers default printer?
Is there a way to dynamically choose a specific printer to print a
report through VBA code?
I know that in the report's page setup you could choose a specific
printer to print from in the page setup but that is not enough for my
needs.
I need to be able to dynamically choose a printer through code.
Is there a way?
Any help will be highly apreciated.
Thanks,
gil

Nov 13 '05 #3
You don't mention what version\ of ms-access.

In access 2002 and later, there is a built in printer object, and it lets
you switch the printer with ease.

You can use:

Set Application.Pri nter = Application.Pri nters("HP LaserJet Series II")
The above means you don't need my code.

So, to save/switch, you can use:

dim strDefaultPrint er as string

' get current default printer.
strDefaultPrint er = Application.Pri nter.DeviceName

' switch to printer of your choice:

Set Application.Pri nter = Application.Pri nters("HP LaserJet Series II")

do whatever.

Swtich back.

Set Application.Pri nter = Application.Pri nters(strDefaul tPrinter)

If you are using a earlier versions of ms-access, then you can use my
lightweight printer switch code here and do the same as above.

http://www.members.shaw.ca/AlbertKal.../msaccess.html
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl************* ****@msn.com
http://www.members.shaw.ca/AlbertKallal
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
9930
by: David Trivette | last post by:
I was wondering if anyone could help me with a MS Access 2002 issue I'm having. Problem - I created a db in Access 97 which worked just fine for several years. In the db the user can generate reports straight to a printer after a query has run. The user of this db just got a new computer with Windows XP and Access 2002. Now when the user runs the report the following error message is displayed:
0
2589
by: Esmee | last post by:
Hi there, I have created an Access 2002 db which contains several reports. Some reports need to be printed on a Laserjet and others on a Labelprinter. One of my clients wants to be able to print the same reports to 3 different laserjets and to 3 different labelprinters. (They work with the db on 3 different units each with their own Laserjet and Labelprinter) For each unit there is a copy of all the reports. The client can make a unit...
5
7119
by: Hank | last post by:
My Access 2000 code has been running for several years in our main plant. Now we need to install it, as a stand-along application, at remote sites, some of which are out of state. My problem is the printer destination for special reports such as stickers and mailing labels. The Mailing Label report is, of course, designed here for a specific printer (Mailing Label). At another site, the name could be completely different. Other than...
1
12173
by: Karthic | last post by:
When i right click on the .rpt file in the VS 2003, i see a property printer setting. It says "No printer" on the top and there is option to select printer and paper settings etc.. I want to know how will this affect a report rendered by a crystal viewer. I have a web page with a crystal viewer rendering the report on the page. I build my application in one of my development machines and deploy it
1
4156
by: Tim Marshall | last post by:
A2003 Most of the time, in past apps, my report routines are usually a preview first and then DoCmd.RunCommand acCmdPrint for the printer dialog. However, I'm now faced with wanting to send a report to a printer of choice withoutthe preview. I'm aware of Albert Kallal's snippet of code that allows you to change the default printer, but I'm wondering if there's any other way?
7
20718
by: Mark | last post by:
Hi, I am creating application in VB 2005. and when I print report it adds extra 0.45 cm margin on left and top, and the reason for this is physical margins of printer. Is it possible to change printer's physical margins using VB coding? Cheers -- Osmotion Blue
8
2880
by: Phil Stanton | last post by:
Using Access 2000 (Yes I know there is no Printer specified) and an MDE File (Yes I know I can't open a report in design view). Is there any way using VBA of temporarily changing the report's printer from the default printer for that report to a PDF995 printer (so that i can print it to a file for subsequent emailing) then back to the default Epsom 830 printer? Thanks for any help Phil
6
9772
by: Ian | last post by:
I am trying to get MS Access 2000 to print names and addresses onto a Dymo 400 label printer, I have set the Access Report to automatically select the correct printer, then select the label size of “99012 Large Address”. This works fine but when I move my database to another PC (with identical Dymo printer and drivers) the report defaults to the correct printer but does not select the label “99012 Large Address”. On different PC’s it...
4
16815
ADezii
by: ADezii | last post by:
Recently, there seems to be several questions specifically related to Printers and changing Printing characteristics for Forms and Reports. For this reason alone, I decided to dedicate this week's Tip to these Topics. The Tip will actually consist of several Tips which I feel are very useful for all Users, from Newbies to Experts. In order to utilize the code contained within these Tips, you must have Access 2002 or later. How can I...
0
9386
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9239
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9158
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9090
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8059
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4764
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3208
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2606
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2148
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.