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

Albert Kallal's printch2k.mdb

This is for Albert or anyone else who uses his code for changing default
printers, printch2k.mdb.

With A2003 on Win XP Pro, whenever I use this code, and then check my
windows Printers window, nothing is marked as default anymore. Then,
when I am in another windows program, say word or what-have-you, when I
print, my print dialog picklist is, of course blank, as no default
printer is marked.

However, when I go back to the A2003 App, Albert's GetDefaultPrinter()
still comes up with a default printer, and, in fact, it's the one I wish
to be the default printer. It's just that no other programs, nor Win XP
itself seems to be able to pick out the default.

All of my printers, except for my Adobe printing, are network printers.

Any comments, suggestions as to what I should look at? Thanks very much
in advance.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
May 18 '06 #1
4 2691
i have one set on my reporting system at work that reads and changes reg
entries but its rough cut but it works for switching my printers round as i
have nightly jobs that run to specific net printers

it changes the default printer in the registry
HKEY_CURRENT_USER\Software\Microsoft\Windows
NT\CurrentVersion\Windows\Device
with the printers in
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts

as the reports machine only uses three printers it was easier to hardcode
the chanes but it does move the default printer
i think i looked at the example you are speaking about and it said something
about the default tick and how it doesn't move it around

if u want a look at the rough code i'll get it tommorow

Aaron
"Tim Marshall" <TI****@PurplePandaChasers.Moertherium> wrote in message
news:e4**********@coranto.ucs.mun.ca...
This is for Albert or anyone else who uses his code for changing default
printers, printch2k.mdb.

With A2003 on Win XP Pro, whenever I use this code, and then check my
windows Printers window, nothing is marked as default anymore. Then, when
I am in another windows program, say word or what-have-you, when I print,
my print dialog picklist is, of course blank, as no default printer is
marked.

However, when I go back to the A2003 App, Albert's GetDefaultPrinter()
still comes up with a default printer, and, in fact, it's the one I wish
to be the default printer. It's just that no other programs, nor Win XP
itself seems to be able to pick out the default.

All of my printers, except for my Adobe printing, are network printers.

Any comments, suggestions as to what I should look at? Thanks very much
in advance.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me

May 18 '06 #2
Tim Marshall wrote:
Any comments, suggestions as to what I should look at? Thanks very much
in advance.


Here's a comment that should be directed at me: RTFM!!!

I just discovered the application.printer object....
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
May 18 '06 #3
Aaron wrote:
i have one set on my reporting system at work that reads and changes reg
entries but its rough cut but it works for switching my printers round as i
have nightly jobs that run to specific net printers


Thank you Aaron, for your effort. However, in playing around with the
printer object, I *think* I've got what I need.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
May 18 '06 #4
I seen that problem.

There is a line of code in the exmaple that is *supposed* to refresh
that..but, it don't seem to always work.

I should note that that code is rather old, and not needed any more...

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)

So, really, I not put any more effort into that code. However, if you do
come up with a refresh fix...I will include it...

Note that following code included in the sample is *supposed* to fix the
problem (but, it does not always work).

Call SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0, ByVal "windows")

However, since that code actually makes a change to the .ini file via the
"writeprofile", it is actually up to window to "catch" this write to a .ini
file..and change it to a registry entry...

That code presumably would work on windows 95....and perhaps even windows
3.1 that used a .ini file....

win 95 and later don't use the .ini file...but windows is supppsoed to still
handle this approach...

Regardless, since ms-access now has this ability built in, not much need for
my code anymore....

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
http://www.members.shaw.ca/AlbertKallal

May 19 '06 #5

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

Similar topics

8
by: deko | last post by:
Is there a rule of thumb for quoting variable values? For example, do I have to put all string number values in quotes? strAbc = "3" ? What about long, int and byte? I assume these are NOT...
13
by: David Mitchell | last post by:
I use the above function in queries for a number of forms and reports. The reports take approx 20 seconds to open. There are only 100 product id's in tblProducts. My concern is that the time will...
4
by: Albert | last post by:
Bye, all: I'm unsubscribing from thiis Usenet group! You guys only talk SHIT Albert
9
by: Arno R | last post by:
Hi all, I was testing Albert Kallal's printerchangecode with an app of mine (A2k) This code is changing the default printer, prints a report, and sets the default printer back to the original...
8
by: MLH | last post by:
I'm using Albert Kallall's code to set printers in A97. I find that on some machines, the code locks up and on others, it does not. I would like to overcome this and was wondering about the...
4
by: Peppie | last post by:
Hi all, I created a button in an Access form that opens MS Word. Now I want this button also to open a specific file. How do I code this? Would it also be possible to let the user select the...
1
by: Esther Lane | last post by:
Hello! First off, many many thanks to Albert who wrote the Mail Merge code for MS Access I am using. It has been working beautifully for a few years. However, my client just (without notice!)...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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
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...

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.