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.
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.
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.
Thank you very much June7. I will try this and reply with my result.
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.