"Uros" <fl****@hotmail.com> wrote in news:HZ*****************@news.siol.net:
Does anybody know how to write data directly to the LPT port from MSAccess.
Now I use
"Open PrtPort For Append Access Write As IntFilenum" then
"Print $IntFilenum, ..........."
but doesn't work well. LPT port does not initialize and POS printer print
weird characters.
When user print blank page from notepade, on this time, printing from
MSAccess works fine until PC is restarted.
Anybody know solution or some other method for writing data to LPT?
Thanks!
Uro¹
1. What is PrtPort? Is it a string holding "LPT1" or similar?
2. I send initialization strings before I begin to print:
.... snippet (for an ancient dot matrix printer)
initialize = Chr(27) & Chr(64)
sixLPI = Chr(27) & Chr(50)
tenPitch = Chr(27) & Chr(80)
bold = Chr(27) & Chr(69)
doubleStrike = Chr(27) & Chr(71)
nonproportional = Chr(27) & "p0"
eject = Chr(12)
printerCodes = initialize & sixLPI & tenPitch & bold & doubleStrike &
nonproportional
.... later
' open the print file
' "LPT1" or "LPT2" etc
fileName = DLookup("Port", "Printer Port", "ID = 1")
' Printer Port is simply a table where one can select the local
printer port
fileNumber = FreeFile()
Open fileName For Output As fileNumber
' printer codes
Print #fileNumber, printerCodes
' data
For iCount = 1 To 60
Print #fileNumber, aLines(iCount)
Next
' return printer to original state
Print #fileNumber, initialize
.... later still ... in normal exit code that errors resume to
Close #fileNumber
--
Lyle
(for e-mail refer to
http://ffdba.com/contacts.htm)