Results 1 to 3 of 3
  1. #1
    cmztrav is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2018
    Posts
    2

    Question Printing (to a printer) the value of a variable directly from code

    Hi all,



    I had some simple subs that calculated a Unicode string and sent it directly to a printer (happens to be a thermal printer used for UPS labels) using the Open # syntax (specifically, to create a handle to the printer) on an older version of Access. I have a new computer running Windows 10 and Access 2016 and the old code is now printing the data to a file instead.

    I have searched and searched, and I have not been able to see anything about performing as simple a task as printing directly to a printer from code. I suspect the paradigm has changed. I hope some kind person might point me in the direction.

    ps: A solution that works for the older versions as well as the newer version of Access would be ideal.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    you would open the port the printer is on,

    Code:
    Open "\\Kb\ZM400" For Output As #1       'Kb = computer Name; ZM400 = Shared printer name
    For rows = 1 To 37 ' send the first 37 rows of ASCII codes from the worksheet "STRINGS"
        Print #1, Worksheets("STRINGS").Cells(rows, 1).Value
    Next
    Close #1

  3. #3
    cmztrav is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2018
    Posts
    2
    Quote Originally Posted by ranman256 View Post
    you would open the port the printer is on,

    Code:
    Open "\\Kb\ZM400" For Output As #1       'Kb = computer Name; ZM400 = Shared printer name
    For rows = 1 To 37 ' send the first 37 rows of ASCII codes from the worksheet "STRINGS"
        Print #1, Worksheets("STRINGS").Cells(rows, 1).Value
    Next
    Close #1
    Thank you for taking a look, but in my post I specified that this syntax was only writing to a file in Access 2016.

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

Similar Threads

  1. POS Applcation printing on thermal printer
    By Business in forum Programming
    Replies: 3
    Last Post: 05-27-2016, 11:22 AM
  2. Thermal printer Slow printing
    By Nasir Ali in forum Programming
    Replies: 2
    Last Post: 05-28-2014, 08:13 AM
  3. Replies: 5
    Last Post: 01-27-2014, 07:50 AM
  4. Setting Printer when Printing Report
    By russ0670 in forum Reports
    Replies: 3
    Last Post: 05-12-2010, 09:45 AM
  5. Printing to an intermec printer from access
    By dkalsow in forum Programming
    Replies: 3
    Last Post: 12-16-2009, 06:11 PM

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