[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

I want to open a cash drawer connect to an Epson TM-T88 printer from VB in MS Access.

Posted on 2004-11-13
5
Medium Priority
?
2,698 Views
Last Modified: 2012-05-05
I have written a neat little POS routine for a specialist retail outlet and now want to open a till drawer. I am using Access 2002, XP Pro - the printer is connected to a USB Port (set up by the Epson driver) and the till drawer is connected to the printer. I have installed a Windows driver (for fancy receipts) and a plain text-only driver.
Any thoughts?
0
Comment
Question by:johnsmorton
  • 3
  • 2
5 Comments
 
LVL 22

Expert Comment

by:danaseaman
ID: 12576949
Try this sub:

Private Sub PopCashDrawer()
   ' OPEN LPT1 FOR OUTPUT
   Open "lpt1" For Output As #1
   ' POP CASH DRAWER
   ' CMD:  <BEL>
   Print #1, Chr$(7)
   ' CLOSE THE LPT1 PORT
   Close #1
End Sub
0
 

Author Comment

by:johnsmorton
ID: 12578420
I've tried something similar - but the receipt printer is attached to a USB Port so opening LPT1 doesn't work - how do I open a USB Port?
0
 
LVL 22

Expert Comment

by:danaseaman
ID: 12579543
See http://www.posworld.com/eprecprinvis.html

Option Explicit

Private Sub Form_Load()
   'A: Open drawer 1 at 50ms.
   'B: Open drawer 1 at 100ms.
   'C: Open drawer 1 at 150ms.
   'D: Open drawer 1 at 200ms.
   'E: Open drawer 1 at 250ms.
   'a: Open drawer 2 at 50ms.
   'b: Open drawer 2 at 100ms.
   'c: Open drawer 2 at 150ms.
   'd: Open drawer 2 at 200ms.
   'e: Open drawer 2 at 250ms.
   OpenCashDrawer "Epson TM-T88", "A"
End Sub

Public Sub OpenCashDrawer(ByVal sDeviceName As String, ByVal sSpecialChar As String)
   Dim prnPrinter       As Printer

   For Each prnPrinter In Printers
      Debug.Print Printer.DeviceName
      If prnPrinter.DeviceName = sDeviceName Then
         Set Printer = prnPrinter
         Printer.FontSize = 10 'Set up the control font.
         Printer.FontName = "control"
         Printer.Print sSpecialChar  'Use special-function character to open the cash drawer.
         Printer.EndDoc
         Exit For
      End If
   Next

End Sub


0
 

Author Comment

by:johnsmorton
ID: 12582984
I know this should work - but I get a compile error "Method or Data Member Not Found" at the Fontname command (and the fontsize). This is really strange as both commands are listed in the VB Help pages! If I type in Printer and dot - an idiot list pops up which does not include fontname and fontsize - it is things like colour and paper bin?
0
 
LVL 22

Accepted Solution

by:
danaseaman earned 375 total points
ID: 12586378
Try running this from Vb6 instead of Access2000. All the Printer.Font properties appear here (Name, Size, Bold, etc.) and I get no compile errors. Im using XP-SP1, VB6-SP5.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month18 days, 3 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question