Results 1 to 4 of 4
  1. #1
    AntnyBrusk is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2015
    Posts
    2

    Macro to print a mailing label


    Hi,
    I need to write a macro to print a single address to a Dymo label printer and create a button for it. Can anyone help me write this macro? I have been trying with no success. Running Access 2010 32 bit version.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Build a report and apply filter criteria that opens report to single record.

    DoCmd.OpenReport "Labels", , , "ID=" & Me.tbxID

    I assume the label printer has a Windows printer driver.

    Options:

    1. set the Dymo printer as the default destination in the report design

    2. code sets the Dymo as default printer in Windows, prints label, resets default printer - requires use of Windows API functions in VBA

    3. open report in Report View and let user select printer destination with Print button from ribbon
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    AntnyBrusk is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2015
    Posts
    2
    Thank you very much June7. I will try this and reply with my result.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Correction, setting printer destination does not require API functions. I was thinking of some other code associated with printer.

    Example code:

    Private Sub btnPrint_Click()
    'print to the label printer
    Dim strDefaultPrinter As String
    'load the current default printer into the variable strDefaultPrinter
    strDefaultPrinter = Application.Printer.DeviceName
    'switch to label printer
    Set Application.Printer = Application.Printers("printer network path and name here")
    DoCmd.OpenReport "Labels", , , "ID=" & Me.tbxID
    'change the printer back to the default printer
    Set Application.Printer = Application.Printers(strDefaultPrinter)
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Cannot get label to print out correctly
    By kdtrimble in forum Access
    Replies: 3
    Last Post: 06-26-2015, 09:19 AM
  2. Access Macro to Clean Up a Mailing List
    By roga789 in forum Access
    Replies: 1
    Last Post: 04-10-2013, 07:08 AM
  3. generating mailing label reports
    By Glider_man in forum Reports
    Replies: 7
    Last Post: 04-26-2011, 10:03 AM
  4. access mailing label message
    By fwit in forum Access
    Replies: 1
    Last Post: 07-14-2010, 01:36 PM
  5. Printing multiple copies of a mailing label
    By Flight Planner in forum Reports
    Replies: 1
    Last Post: 10-19-2006, 08:16 AM

Tags for this Thread

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