473,327 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

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 50147
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.newsgroups.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.Printer = Application.Printers("HP LaserJet Series II")
The above means you don't need my code.

So, to save/switch, you can use:

dim strDefaultPrinter as string

' get current default printer.
strDefaultPrinter = Application.Printer.DeviceName

' switch to printer of your choice:

Set Application.Printer = Application.Printers("HP LaserJet Series II")

do whatever.

Swtich back.

Set Application.Printer = Application.Printers(strDefaultPrinter)
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********@hotmail.com> replied in message
news:bf**************************@posting.google.c om...

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
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...
5
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...
1
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...
0
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...
7
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...
3
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...
8
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...
9
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...
3
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?...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.