USB cash drawer trigger in MS Access

K

keithb

I have a till system running on MS Access 2003 and have my receipt
printer (Star Micronics TSP100) connected to my PC in USB002 port. My
cash drawer then connects to the back of the receipt printer via an
RJ12 connector. When I print a receipt it opens the cash drawer
without a problem. However, what I want to do is have a button for
'Change' and when I click on it, it just opens the cash drawer without
needing to print anything.

I have trawled through the accompanying documentation wthat came with
the printer and it says that I need to send Chr(7) to the printer to
do this. However, I dont know how I can achieve this. Can anybody
help me with this?

Thanks in advance

Keith
 
K

Ken Snell \(MVP\)

You open the parallel port (assuming it's LPT1) for printing, and then send
the Bell character to that printer:

Public Sub OpenTheCashDrawer()
Dim intFreeFile As Integer
intFreeFile = FreeFile()
Open "lpt1" For Random As #intFreeFile
Print #intFreeFile, Chr(7)
Close #intFreeFile
End Sub

Note that the above code will not work if you're running ACCESS 2003 as a
runtime installation. If that is what you're doing, post back and I'll
provide different code that will work in that environment.
 
K

keithb

You open the parallel port (assuming it's LPT1) for printing, and then send
the Bell character to that printer:

Public Sub OpenTheCashDrawer()
Dim intFreeFile As Integer
intFreeFile = FreeFile()
Open "lpt1" For Random As #intFreeFile
Print #intFreeFile, Chr(7)
Close #intFreeFile
End Sub

Note that the above code will not work if you're running ACCESS 2003 as a
runtime installation. If that is what you're doing, post back and I'll
provide different code that will work in that environment.

--

        Ken Snell
<MS ACCESS MVP>









- Show quoted text -

Hi Ken,

Thanks for your help. I am using USB002 port not LPT1.

keith
 
K

Ken Snell \(MVP\)

Did you try replacing lpt1 with usb002 in the Open statement?

--

Ken Snell
<MS ACCESS MVP>


You open the parallel port (assuming it's LPT1) for printing, and then
send
the Bell character to that printer:

Public Sub OpenTheCashDrawer()
Dim intFreeFile As Integer
intFreeFile = FreeFile()
Open "lpt1" For Random As #intFreeFile
Print #intFreeFile, Chr(7)
Close #intFreeFile
End Sub

Note that the above code will not work if you're running ACCESS 2003 as a
runtime installation. If that is what you're doing, post back and I'll
provide different code that will work in that environment.

--

Ken Snell
<MS ACCESS MVP>









- Show quoted text -

Hi Ken,

Thanks for your help. I am using USB002 port not LPT1.

keith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top