Results 1 to 5 of 5
  1. #1
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682

    Select Default Printer

    vba code/form to list your printers and select your default printer.

  2. #2
    Nod_Swerdna is offline Novice
    Windows 8 Access 2007
    Join Date
    Feb 2015
    Posts
    27
    I have been trying to find code to do exactly this. Are you able to show me the code please...
    Don.

  3. #3
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    I believe its something like (untested)

    Code:
    Dim prt as Printer
    
    for each prt in Application.Printers
       me.combobox1.additem prt.devicename
    next
    and then to set your printer you use
    application.printer = me.combox1.text

  4. #4
    Nod_Swerdna is offline Novice
    Windows 8 Access 2007
    Join Date
    Feb 2015
    Posts
    27
    Thank you for the Tip. The combo box works perfectly. I am having a bit of trouble assigning the application printer the value of the combo box but I can work that out.
    Thanks again, Don...

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,715
    This might be useful, allows you to switch a printer, print something, then restore the default printer.

    Code:
    Sub SwitchPrinter()
               Dim PRT As Printer
               ' Get current default printer
    10         Set PRT = Application.Printer
                
    20         Debug.Print "Current default is " & PRT.DeviceName
               ' Set default printer
    30        Set Application.Printer = Application.Printers("\\AMD_XP\Brother MFC-240C USB Printer (Copy 1)")
                ' Print something, e.g.
    40          Debug.Print "Switched to " & Application.Printer.DeviceName
              'Print a specific file
    50        ' DoCmd.PrintOut TablA           'uncomment to print on the revised printer
    
               ' Restore original printer
             '  Set Application.Printer = prt    'uncomment to restore the previous default printer
    60         Debug.Print "Reset default is " & PRT.DeviceName
     End Sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Setting Printer when Printing Report
    By russ0670 in forum Reports
    Replies: 3
    Last Post: 05-12-2010, 09:45 AM
  2. no way to set default export to .xls ?
    By yinchiao in forum Import/Export Data
    Replies: 0
    Last Post: 04-05-2010, 12:33 PM
  3. Default Value CurrentMonth
    By Bruce in forum Forms
    Replies: 7
    Last Post: 01-27-2010, 08:39 AM
  4. Printing to an intermec printer from access
    By dkalsow in forum Programming
    Replies: 3
    Last Post: 12-16-2009, 06:11 PM
  5. Can docmd.openreport print X copies on Y printer?
    By Coolpapabell in forum Reports
    Replies: 1
    Last Post: 09-02-2009, 08:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums