Set Default Printer in Module (1 Viewer)

JohnLee

Registered User.
Local time
Today, 00:15
Joined
Mar 8, 2007
Messages
692
Good day,

I have a module which runs a number of queries, prints reports and exports tables. The section I need help with is setting the default printer.

My users of the database have a habit of not setting the correct printer before running this module, which causes problems, which is an administrative thing which is outside of the control of this module.

If I could write code that checks which printer has set as their default printer before the reports are run, it would be of great assistance.

What I would like to do is check to see if they have the correct printer set as their default printer if they don't have the correct printer set as their default printer then change it from whatever printer they have to the correct default printer.

Any Assistance would be most appreciated, Oh I have limited VB knowledge, so please bear this in mind, thanks once again.

John
 

MStCyr

New member
Local time
Today, 03:15
Joined
Sep 18, 2003
Messages
333
Good day,

I have a module which runs a number of queries, prints reports and exports tables. The section I need help with is setting the default printer.

My users of the database have a habit of not setting the correct printer before running this module, which causes problems, which is an administrative thing which is outside of the control of this module.

If I could write code that checks which printer has set as their default printer before the reports are run, it would be of great assistance.

What I would like to do is check to see if they have the correct printer set as their default printer if they don't have the correct printer set as their default printer then change it from whatever printer they have to the correct default printer.

Any Assistance would be most appreciated, Oh I have limited VB knowledge, so please bear this in mind, thanks once again.

John

Hello

Please find attached a sample database that I have posted in the sample database area several years ago showing how to select the default printer.

Best regards

Maurice
 

Attachments

  • SelectDefaultPrinter_Sent.zip
    46.3 KB · Views: 2,146

JohnLee

Registered User.
Local time
Today, 00:15
Joined
Mar 8, 2007
Messages
692
Hi MStCyr,

Thanks for that, that worked a treat just as it is. just what I needed. your a star.

John
 

JohnLee

Registered User.
Local time
Today, 00:15
Joined
Mar 8, 2007
Messages
692
Hi John

Glad I could be of help.

Best regards

Maurice

Hi Maurice,

I thought your DB you provided was great, however I didn't check it worked throughly, because when I tried to change the current default printer to a different one in your form view, following the instructions to double click on the required printer, it didn't change the printer! Any suggestions, I'm using Access 2000

Your assistance would be greatly appreciated.

John
 

MStCyr

New member
Local time
Today, 03:15
Joined
Sep 18, 2003
Messages
333
Hi John

Out of the 1101 downloads, there has been 1 report of a problem with the database and that was on a Windows XP machine.

Have you checked the References??

Maurice
 

JohnLee

Registered User.
Local time
Today, 00:15
Joined
Mar 8, 2007
Messages
692
Hi Maurice,

Thanks for your response, I know how to write If Then Else and For Next statements, but what you've written is well over my head, so I'm not clear, when you asked me if I had checked the references.

The organisation I work for is using Office 2000 operating system, don't know if that makes a difference though.

What should I be looking for and where.

Your assistance is most appreciated.

John
 

MStCyr

New member
Local time
Today, 03:15
Joined
Sep 18, 2003
Messages
333
Hi Maurice,

Thanks for your response, I know how to write If Then Else and For Next statements, but what you've written is well over my head, so I'm not clear, when you asked me if I had checked the references.

The organisation I work for is using Office 2000 operating system, don't know if that makes a difference though.

What should I be looking for and where.

Your assistance is most appreciated.

John

Hi John

Office 2000 is good, however it is not the operating system...Windows 95,98, etc. would be. In order to check the References, just go into any Module and then from the Menu, select Tools ->References.

Maurice
 

JohnLee

Registered User.
Local time
Today, 00:15
Joined
Mar 8, 2007
Messages
692
Hi Maurice,

Below is a list of what is checked in the References option

Visual Basic For Applications
Microsoft Access 9.0 Object Library
OLE Automation
Microsoft ActiveX Data objects 2.1 Library

Your assistance appreciated.

John
 

MStCyr

New member
Local time
Today, 03:15
Joined
Sep 18, 2003
Messages
333
Hi Maurice,

Below is a list of what is checked in the References option

Visual Basic For Applications
Microsoft Access 9.0 Object Library
OLE Automation
Microsoft ActiveX Data objects 2.1 Library

Your assistance appreciated.

John

Hi John

Do any of the References have the word MISSING in front of them? If so, simply uncheck them and click OK.

Hope this helps.

Maurice

Here's a complete blurb on References....

This can be caused by differences in either the location or file version of
certain files between the machine where the application was developed, and
where it's being run (or the file missing completely from the target
machine). Such differences are common when new software is installed.

On the machine(s) where it's not working, open any code module (or open the
Debug Window, using Ctrl-G, provided you haven't selected the "keep debug
window on top" option). Select Tools | References from the menu bar. Examine
all of the selected references.

If any of the selected references have "MISSING:" in front of them, unselect
them, and back out of the dialog. If you really need the reference(s) you
just unselected (you can tell by doing a Compile All Modules), go back in
and reselect them.

If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added. If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out
of the dialog, then go back in and reselect the references you just
unselected. (NOTE: write down what the references are before you delete
them, because they'll be in a different order when you go back in)
 

JohnLee

Registered User.
Local time
Today, 00:15
Joined
Mar 8, 2007
Messages
692
Hi Maurice,

Thanks for your help, tried all your suggestions but still not allowing the change of default printer.

I note that when I double click in the default [printer] text box that I get the message "OpenPrinter Failed!". I assume that means that it can't communicate with the default printer, even though the default printer is showing in this text box.

Doesn't look like I'm going to be able to get it to work in the way that I'd like, obviously something to do with the way our system is set up.

but thanks anyway.

John
 

JohnLee

Registered User.
Local time
Today, 00:15
Joined
Mar 8, 2007
Messages
692
Hi Maurice,

I've had one of our IT guys have a quick look at the database sample you provided, he says that it appears that your code is not finding our operating system, which is windows 2000. As he is not a programmer, he isn't able to help me with resolving what needs to be done.

Your further assistance would be most appreciated.

John
 

MStCyr

New member
Local time
Today, 03:15
Joined
Sep 18, 2003
Messages
333
Hi Maurice,

I've had one of our IT guys have a quick look at the database sample you provided, he says that it appears that your code is not finding our operating system, which is windows 2000. As he is not a programmer, he isn't able to help me with resolving what needs to be done.

Your further assistance would be most appreciated.

John

Hi John

That's what I'm running here, Windows 2000... I also tried it on Windows 98 and it runs quite well on both systems

Maurice
 

JohnLee

Registered User.
Local time
Today, 00:15
Joined
Mar 8, 2007
Messages
692
Good day Maurice,

Thanks for your response, I managed to figure out what needed to be changed with some help from our IT guy. So alls well that ends well.

Cheers

John
 

Users who are viewing this thread

Top Bottom