Link to home
Start Free TrialLog in
Avatar of segood
segood

asked on

Send HEX caracters to Generic/Text Printer for printing

I have a database which collects scrap/reject information then generates a tag
which will be affixed to the bad product.  I am having a problem with the "label" printer which generates these tags.  It requires that HEX characters be sent to it.  It
does not understand forms, it accepts the HEX characters then compiles the
code and generates a tag/label.  

We do not know how to "send" the hex info to the printer for compiling.
Here is some BASIC code which is used by our other system to do the same thing.  How do
I get access to do the same thing.  I do not know BASIC but have been given this assignment to get completed.

ESC="1B"
ESC = ICONV(ESC, "MX") 'Converts ASCII character strings to hex equivalent

FDESC = "NonConforming"
FDESCLEN = LEN(FDESC)
PDESC = Part Description from parts file

Print ESC:"A":            'Turns on Printer
Print ESC: "H10": ESC:"V50";Font:PDESC[1,5]:
Print ESC:"H25":ESC:V425";FONT:ABS(TQTY):ESC:"H425":ESC:"V425":FONT:"PCS":

Any help is appreciated
Thanks,
Steve
Avatar of TimCottee
TimCottee
Flag of United Kingdom of Great Britain and Northern Ireland image

Steve, would this be a SATO printer by any chance?
Avatar of segood
segood

ASKER

EXACTLY!!!!!!!!!!!!!!!!!
So converting this to access/vb would be

Dim Esc As String * 1
Dim FDesc As String
Dim FDescLen As Integer
Dim PDesc As String
Dim Font As String
Esc = Chr$(27)
FDesc = "NonConforming"
FDescLen = Len(FDesc)
PDesc = "Part Description from parts file"
Font = Esc & "L0202" & Esc & "S" ' this is a specific SATO Font size and style, you would probably need to change it to whatever you are using.
strMessage = Esc & "A" & Esc & "H10" & Esc & "V50" & Font & Mid$(PDESC,1,5) & Esc & "H25" & Esc & "V425" & Font & ABS(TQTY) & Esc & "H425" & Esc & "V425" & Font "PCS" & Esc & "Q0001" & Esc & "Z"

Then you need to output the string strMessage to the printer directly. How you do this may depend on whether the printer is local or connected to a netport or other device.
Avatar of segood

ASKER

We are still having trouble getting the info to the printer.  It is a local prnter on LPT1.
We using the command

strMessage.Print

but recieve the error:"Run Time Error 424", Object Required."

What are we doing wrong?

Thanks,
Steve
strMessage is a string variable rather than a printer so you would need to use

Printer.Print strMessage

Or

Open "LPT1:" For Output As #1
Print #1,strMessage
Close #1

Though I don't know whether that will work. I have to go shortly but will have a proper look at this tomorrow.
Avatar of segood

ASKER

  Dim FDesc As String
    Dim PDesc As String
    Dim FdescLen As Integer
    Dim Font As String
   ' Chr$(27) = Chr$(27)
    FDesc = Chr$(27) + "A" + Chr$(27) + "#E4" + Chr$(27) + "H10" + Chr$(27) + "V50" + "This is a Test" + Chr$(27) + "Q2" + Chr$(27) + "Z"
    Open "LPT1:" For Output As #1
    Print #1, FDesc
    Close #1

THis is what we tried along with Dimming the Chr$(27) to ESC.  All we got from the
printer was a beep.  

What else can we try?
STeve
ASKER CERTIFIED SOLUTION
Avatar of TimCottee
TimCottee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of segood

ASKER

Thanks it worked good.
I also later found out that SATO has created a print driver for Access.

Thanks Again, a real butt saver.
Steve
Steve, glad to be of help. I would be interested in the printer driver if you could give me details of it. My Email address is in my profile.