setting report and form printer name and settings

I am trying to give my users complete control of printer selection and settings paper source, paper size, orientation, duplex printing) for forms and reports of my Access 2000 MDE database.  I have reasearched into DEVMODE and DEVNAMES but I understand they must be used in design view and can't be used in an MDE file.  I found "On the Fly Pinting" ( but it does not support printer settings for MDE files.  I found the following link: which shows code for changing the printer but not the settings.  I am planning to link an MDB file located on each computer's local drive to the main MDE file so the user can specify the printer and settings he wants on that machine.  When each report is printed, the table in the MDB file is looked up and the printer is selected and settings set.  Or the user can click another button if he wants to change the printer or settings for one printing.  Any suggestions are requested.  TIA
LVL 39
Who is Participating?
PashaModConnect With a Mentor Commented:
Closed, 500 points refunded.
Community Support Moderator
try using the Printers Collection.

Set Application.Printer = Application.Printers([PrinterName in Quotes])
I think earliest version that uses this is Access2000
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

That will change the default printer for the current session of Access.  The printer properties can also be accessed from this collection.  If you're looking to create a way to allow the user to select his own printer, create a combo box to list them.
create the combo box with the following settings:

Name = cboPrinters
Row Source Type = Value List
Row Source = [Leave Blank]
Column Count = 2
Column Widths = 0";4;
Bound Column = 1
List Width = 4"
Limit To List = Yes

Then put the following code in the Load event of the form containing the combo box:

Dim intCounter As Integer
Dim strRowSource As String

For intCounter = 0 To Application.Printers.Count - 1
    strRowSource = strRowSource & CStr(intCounter) & ";" & Application.Printers(intCounter).DeviceName & ";"

Me.cboPrinters.RowSource = strRowSource
That will give you the option to select the printer, and you can bind the combo box to a field to save the setting.  The field will contain the index number of the printer, not the name.  You can then call the printer every time access is opened by running the following code:

set application.printer = application.printers([Index Number W/Out Brackets])
as far as the other printer settings, you should be able to find them through the printers collection properties.  Look up "Printers Collection" in the Visual Basic help file.
thenelsonAuthor Commented:
mcorrente , thanks for the suggestions but I think the "Printers Collection" became available with Access 2002 and 2003.  I could not find any reference to it in 2000.  I tried building the combo box form/code but it failed at the line:
For intCounter = 0 To Application.Printers.Count - 1  
with the error message that "Printers" method or data member not found.

If I don't find another answer, I may have to upgrade to 2003.
hmmm.... you might be right, come to think of it.  I know for a fact it runs on 2002, but I believe I had to work around it in 2000.  Well... I know this solution works for later versions.  Hopefully someone else can help you with 2000.
thenelsonAuthor Commented:
Searching the web, I came up with a solution to my original question:

To change default printer:
Use the code at:
(This will not work in Office XP running Windows XP so for a universal solution, you would wantto check the Access version and use printers collection for Office 2002 or 2003)

To set and save printer settings:   (from:
'display printing preferences:
Shell ("rundll32 printui.dll,PrintUIEntry /e /n" Chr(22)  & strPrinterName & Chr(22))
'Store printer settings into a file:
Shell (rundll32 printui.dll,PrintUIEntry /Ss /n Chr(22)  & strPrinterName & Chr(22)  /a Chr(22)  & strFileName & Chr(22))

To set printer settings:
'Save previous settings:
Shell (rundll32 printui.dll,PrintUIEntry /Ss /n Chr(22)  & strPrinterName & Chr(22)  /a Chr(22)  & strPrevFileName & _ Chr(22))
'Recall (set) printer settings from a file:
Shell (rundll32 printui.dll,PrintUIEntry /Sr /n Chr(22)  & strPrinterName & Chr(22)  /a Chr(22)  & strFileName & Chr(22))
'Recall previous settings
Shell (rundll32 printui.dll,PrintUIEntry /Sr /n Chr(22)  & strPrinterName & Chr(22)  /a Chr(22)  & strPrevFileName & _ Chr(22))
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.