FredixBlog


Just my log about anything I could find enjoyable.



Connecting with tools such as cash drawer

author Posted by: fredometro on date Jan 6th, 2004 | filed Filed under: MS-Access

Quertion: I try to develop Point of Sales program by access. I have trouble in connecting the program with the tools such as cash drawer. My question is that if on click event I want to drawer to activate (Open) How do I?
Drawer connect to PC using serial port
Thanks

Fredix gave this response on 4/3/2002:
Hi!

You have two choices: The simplest is to use .bat files that sends the appropriate commands. You call the .bat with the shell() function.

More sophistcated and better method is to use the MsComm control. It contains all the features for controlling the serial ports.
Look at this page for a good example:

http://www.freevbcode.com/ShowCode.Asp?ID=2236
Regards.

Fredix gave this response on 4/3/2002:
Here is an example. There is only a three line .bat file, called print.bat:

mode com1:19200,n,8,1
type c:\\caisse\\pfile > com1
exit

When I need to send some characters to the peripherals, I build the c:\caisse\pfile like this:

Open “c:\\caisse\\pfile” For Output As 1
Print #1, Chr(27) & “=” & Chr(1);
Print #1, Chr(27) & “p” & Chr(0) & Chr(20) & Chr(20);
Close 1

Finally call the print.bat, which sends the file to Com1

Shell(”c:\\caisse\\print.bat”, 7)

This method works quite well and is easy to implement. However, the problem is that the DOS window remains on the screen. To avoid this, the first time the window is here, right-click the top of the window, choose properties and check the box ‘close on exit’.
I would prefer using MSComm control, but the app was in Access 2.0, so I had no choice. The advantage with MSComm is that you can check if the peripherals are ready. This is important as this program must run the whole day long, and there is a client in front of the user.

Good luck with your program