<

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

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

Published on
3,829 Points
829 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
0 Comments

Featured Post

OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Make it easier to see the current record on your Microsoft Access forms! To highlight the current record with a yellow background color, use Conditional Formatting, a control to keep track of the primary key value, a control to change color, and a l…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month