[AccessD] Changing Default Printer

Charlotte Foust cfoust at infostatsystems.com
Wed Aug 8 12:23:20 CDT 2007


Um ... Is this PDF printer something you provide in your app?  We've
found that we needed to include an installer for our clients to
reinstall their PDF printer when it went sideways, and we ran into
problems if a full version of Adobe Acrobat was installed on the same
machine.

Charlotte Foust 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
at Beach Access Software
Sent: Wednesday, August 08, 2007 9:09 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Changing Default Printer

Well, that won't be a problem for my app.  Al I want to do it have the
user switch to a PDF printer for reports which will then be attached to
emails.


Rocky



 	
	

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte
Foust
Sent: Wednesday, August 08, 2007 8:52 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Changing Default Printer

OY!! After all this time I don't recall.  I know I wrote printer object
based code to replace all our old code to set page size properly and
then after testing it a bit, I threw it out and went back to the
original code.
I don't think it was a problem with selecting the printer, it was trying
to manipulate the page settings that gave us problems.

Charlotte Foust 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
at Beach Access Software
Sent: Wednesday, August 08, 2007 8:45 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Changing Default Printer

Uh-oh.  What problems did you have with the Printer object?  Is that the
same as using Application.Printer?

Rocky
 




 	
	

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte
Foust
Sent: Wednesday, August 08, 2007 8:08 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Changing Default Printer

A2002 was the first version to have a printer object.  I have to tell
you, though, that we tried it and went back to API calls as more
consistent and reliable.

Charlotte Foust 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
at Beach Access Software
Sent: Wednesday, August 08, 2007 7:21 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Changing Default Printer

What version of Access has that Printer object?  And that code would go
into the report in the load or open event?  The code I found that I
posted yesterday works in A2K3, it's real short, but does it at the OS
level, which is probably more sketchy than doing it inside Access
itself. What to you think?

Rocky





 	
	

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
paul.hartland at fsmail.net
Sent: Wednesday, August 08, 2007 1:40 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Changing Default Printer
Importance: High

Rocky,

Not the neatest code in the world, but works for me:

    Dim prnPrinter As Printer
    Dim strDeviceName As String
    Dim bolFoundPrinter As Boolean
    
    strDeviceName = Printer.DeviceName    ' Store current default
printer
    bolFoundPrinter = False
    For Each prnPrinter In Printers
        If (prnPrinter.DeviceName = "NewPrinterName") Then
            Set Printer = prnPrinter
            bolFoundPrinter = True
            
            ' DO WHAT YOU WANT HERE TO PRINT
            
            Exit For
        End If
    Next
    ' Change back to original default printer
    For Each prnPrinter In Printers
        If (prnPrinter.DeviceName = strDeviceName) Then
            Set Printer = prnPrinter
            Exit For
        End If
    Next


this is in VB6, so I assume should work in VBA for Access



Message Received: Aug 07 2007, 08:49 PM
From: "Rocky Smolin at Beach Access Software" 
To: "'Access Developers discussion and problem solving'" 
Cc: 
Subject: [AccessD] Changing Default Printer


Dear List:

Slightly different request for changing printers to the one I had a few
day
ago:

Is there an easy way to save the current windows default printer and
change to a user pre-selected printer (name stored in an local options
table)?

This is for a distributable app so there's no way to know what the
installed printers are. The program needs to print to a PDF file. So the
user has to have a PDF printer installed. They pre-select it through a
combo box on a control panel loaded with all the installed printer names
and the printer name is saved in a local table. The app then runs at
night without user intervention triggered by windows scheduler. So when
it runs these reports, I need it to change the windows default printer
to whatever printer they select. And then change it back after I'm done
printing.

MTIA

Rocky






--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





Paul Hartland
paul.hartland at fsmail.net
07730 523179
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.476 / Virus Database: 269.11.8/941 - Release Date: 8/7/2007
4:06 PM
 

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.476 / Virus Database: 269.11.8/941 - Release Date: 8/7/2007
4:06 PM
 

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.476 / Virus Database: 269.11.8/941 - Release Date: 8/7/2007
4:06 PM
 

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list