473,395 Members | 1,856 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,395 software developers and data experts.

restoring default printer

I have vb code that gives a user the option to select the printer for
printing a report. At the end I change the default printer back to what
it was. Unfortunately the code I found is for win9x so it is not
working when restoring the default, and I cannot find anything on what
the XP code is.

Win9x code is: Call SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0,
ByVal "windows")

Does anyone know what it is for XP?

Nov 13 '05 #1
3 4514
On 6 Sep 2005 15:07:54 -0700, "sakuragirl1" <sa*********@yahoo.com>
wrote:

This is NOT the code that changes the printer. Rather, this broadcasts
to all applications that some system setting change has been made.
Apps can listen for such messages, and configure themselves
accordingly.

In Access2002 and up, you may want to look at the new Printer object.

-Tom.

I have vb code that gives a user the option to select the printer for
printing a report. At the end I change the default printer back to what
it was. Unfortunately the code I found is for win9x so it is not
working when restoring the default, and I cannot find anything on what
the XP code is.

Win9x code is: Call SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0,
ByVal "windows")

Does anyone know what it is for XP?


Nov 13 '05 #2
yes, my lightweight printer switch code often has this probelm.

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 printer
switch code here:

http://www.members.shaw.ca/AlbertKal.../msaccess.html

And, I don't have a good solution to your problem, but if you use acces 2002
or later...it don't matter
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
http://www.members.shaw.ca/AlbertKallal
Nov 13 '05 #3
Thank you so much for your help. I am using Access 2003, and the
information you provided fixed the issue i was having. If you can't
tell this is one of my first Access projects, and I really appreciate
having a place where I can ask questions, and have them answered! ^_^

Nov 13 '05 #4

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

Similar topics

1
by: Pablo | last post by:
Friends, how can i get the name of the default printer??. I'm working with winforms. VB,C#, nevermind. Thanks a lot Pablo
0
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...
2
by: MLH | last post by:
I would like to allow users to set, as an application default, a specific printer to send reports to. I don't know how to bring up a list of valid print devices in A97, nor do I know how to...
2
by: Willem | last post by:
Hi, I'm trying to get the default printer using WMI. I use the following code: Private Function GetDefaultPrinter() As String Dim objWMIService As Object Dim colInstalledPrinters As Object...
0
by: Karthick_Microsoft | last post by:
Actually, in my ASP.Net application, i have a requirement of automatically changing the default printer. I did a OCX using VB and put it on the web page. The client machines do not have local...
1
by: i8mypnuts | last post by:
Could someone please help? I am using the 'defaultprt.zip' tool provided by Ken Getz to change the default printer via VBA code (code below). My problem is that once the default printer has been...
1
by: groulder | last post by:
hi all, i have a problem with a network database that's used by a lot of people. people are finding, they will start the database, and if the mouse is moved over the print icon, the tooltip...
2
sashi
by: sashi | last post by:
Set default printer You will often find yourself in a position where you have designed a report format for one printer and when that report is sent to another printer the layout is messed up. ...
3
by: brianflannery | last post by:
Greetings all! My problem is this. I've installed a new printer on my computer. This is the "default printer" for access. Now, some of my reports, which were working fine with the old printer,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...
0
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,...

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.