<

MS Access How To Control and Open a POS Cash Register Cash Drawer With VBA

Published on
3,502 Points
502 Views
Last Modified:
A quick solution showing how to control and open a POS Cash Register Drawer using VBA with MS Access.

Hello all! I wanted to share this quick tutorial to help anyone out who might be struggling with this same procedure. 


I will list what my setup is below and you can adapt it from there. Note that I am in no way an expert and quite frankly, am relatively new at this.  With that said...


My Setup


  • Access 2016
  • Windows 7
  • Par (APG) Brand Cash register drawer
  • USB to Printer Adapter Model BT-100U Found on Amazon AMAZON BT-100U LINK HERE
  • APG CD-101A Printer Cable Also found on Amazon AMAZON PRINTER CABLE LINK HERE
  • **APG CD-101A Printer Cable is a special cable with an RJ45 Ethernet cable on one end and an RJ11 (Phone Cable) end on the other.


  


When I plugged in my Adapter I made sure to have it connected to the register. 


The driver should come up as a "Prolific USB-to-Serial Comm Port (Your Com Port Here)" ***Remember which COM Port it says.


The following code is what I used to pop the drawer right open:


Private Sub OpenCashDrawer()
On Error GoTo Errorhandler
Dim LocationPort As String

LocationPort = "Com4" 'Replace Com4 with the com port you are using. Example is Com3, Com2, etc.....

Open LocationPort & ":9600,n,8,1" For Output As #1
Print #1, "" 'This is just sending a signal like it is printing something but it is not.
Close #1

Exit Sub
Errorhandler:
MsgBox "Error " & Err.Number & ": " & Err.Description & " in " & _
VBE.ActiveCodePane.CodeModule, vbCritical, "Error in btnOpenCashDrawer_Click"
End Sub

This worked for me, so I hope this helps someone out.


0
Comment
0 Comments

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Join & Write a Comment

In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month