PRINT# - Ejecting Cash Drawer

A

Arnoldcch

Dear All,

I got some sample code in QBASIC and try to convert them to run in
VBA/MSAccess. Anyone knows how to do that? Very much appriciated for your
help.......

' eject drawer through COM1
OPEN "COM1:300,N,8,1"
FOR RANDOM AS #1
PRINT #1, "00000000"

' eject drawer through EPSON printer
PRINT #1, CHR$(&h1b); "p; CHR$(0); CHR$(100); CHR$(250)

I've tried this in the OnClick event and tried to send through Epson printer
from LPT1 but doesn't work...... what's wrong with that???

------------------------------------------------
Private Sub Eject_Drawer_Click()
On Error GoTo Err_Eject_Drawer_Click


'String For Drawer through LPT1????
Open "LPT1:300,N,8,1" For Random As #1

Debug.Print (&H1B) & "p" & Chr$(0) & Chr$(100) & Chr$(250)

Close #1


Exit_Eject_Drawer_Click:
Exit Sub

Err_Eject_Drawer_Click:
MsgBox Err.Description
Resume Exit_Eject_Drawer_Click

End Sub
--------------------------------------------------------

Thousands thanks for your help. (As I've been flated out in finding helps
for the pass 3 months but not much help.....)

~Arnold~
 
B

Brendan Reynolds

Well, Debug.Print prints to the Immediate window, not to a file, so you need
to change that to Print #1

I'm not sure that's the only issue, but it's a start.

BTW: It's safer to use the FreeFile function to get the next available file
number than to hard-code it ...

Dim intFile As Integer

intFile = FreeFile
Open <etc> As intFile
Print #intFile ...
....
Close intFile

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
E

ecurveman

I have been tring to find a solution to cash drawer opening also after
discussing the problem with a local computer service he explain thr cash is
offing activated throuh the reciept printer.I would be interested a
programing solution with access if you find an alteritive.

Bruce
 

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