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

Dustin StanleyEntrepreneur
Published:
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
2,954 Views

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.