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

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?
johnsmortonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

danaseamanCommented:
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
johnsmortonAuthor Commented:
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
danaseamanCommented:
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
johnsmortonAuthor Commented:
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
danaseamanCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.