473,545 Members | 534 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change printer in vba code

I have a form that I send to a printer. The workstation that is using
the DB has more then one printer defined. The default is NOT the printer
that I want to use for output from the report/form.

How do I send the out of a report, using VBA, to a specific printer?

Michael Charney

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #1
4 50209
Nothing wrote:
I have a form that I send to a printer. The workstation that is using
the DB has more then one printer defined. The default is NOT the printer
that I want to use for output from the report/form.

How do I send the out of a report, using VBA, to a specific printer?


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

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #2
Nothing <me@you.com> wrote in message news:<41******* *************** @news.newsgroup s.ws>...
I have a form that I send to a printer. The workstation that is using
the DB has more then one printer defined. The default is NOT the printer
that I want to use for output from the report/form.

How do I send the out of a report, using VBA, to a specific printer?

Michael Charney

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Umm... Allen Browne has this somewhere, I think. It's in the Access
<version#> Handbooks... prolly in this NG... search around.
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, then you can use my lightweight
"simple" printer switch code here:

http://www.attcanada.net/~kallal.msn.../msaccess.html
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl************* ****@msn.com
http://www.attcanada.net/~kallal.msn
Nov 13 '05 #4
It's at:
http://members.iinet.net.au/~allenbr...pPrintMgt.html
but for Access 2002/2003 only.

For earlier versions, the article has a link to Albert's code.

--
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.

"Pieter Linden" <pi********@hot mail.com> replied in message
news:bf******** *************** ***@posting.goo gle.com...

Umm... Allen Browne has this somewhere, I think. It's in the Access
<version#> Handbooks... prolly in this NG... search around.

Nov 13 '05 #5

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

Similar topics

1
10580
by: Stephen Barrett | last post by:
I am doing word automation with Word 2003. Everything works great except for one thing. When I set the word object's ActivePrinter to a different printer, it changes the system default. I looked for help on MS site and they say it is a known issue. The work around is to use WordBasic commands like as follows. ...
5
7107
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...
1
1693
by: AngelCaido | last post by:
ok... so i have Internet Explorer open, with let say http://www.google.com i want my application to print that page into a file so i have a printer PS-Printer installed i dont know .. how .. to change the printer how to tell to explorer to print how to add the path of the saved file Thanks...
0
1889
by: mfarouk | last post by:
Hi All, I need to change the port of the priner in my program. as the printer may be attached to another port. It is an USB printer. I tried to use GetPrinter & SetPrinter APIs with structure PRINTER_INFO_2 but nothing changed, may be I miss use the APIs I hope some one can help me to change the port of the printer. Thanks MFG
7
20686
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
3
13004
by: bsm | last post by:
Hi, I have File Upload control in my form. When I click Enter key, it triggers "Submit" button event. So I wrote onkeydown function as follows: if (window.event.keycode == 13) { return false; }.
8
2871
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...
9
1571
by: Briansmi1116 | last post by:
I downloaded a template off of the microsoft website, and I am trying to change this code: =nz()+nz()+CLng((nz()+nz())*nz()*100)/100 I want to get the sales tax to calculate to the Parts Total, and then add Labor. I do not want to tax the Labor. Any ideas? Thanks, Brian
3
4130
drhowarddrfine
by: drhowarddrfine | last post by:
I have a simple vbscript that extracts a web page, saves it to a file, then uses notepad to print that file to the default printer. What can I do to make it print to a specified non-default printer? txtfile.WriteLine(xmlhttp.responseText) txtfile.Close 'enable this to print 'oWS.Run "NotePad.exe /p " + path ...
0
7456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7390
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7649
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. ...
1
7410
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...
1
5320
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4940
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3442
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1869
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
1
1010
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.