By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,276 Members | 1,312 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,276 IT Pros & Developers. It's quick & easy.

Write to LPT

P: n/a
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č
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"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)
Nov 12 '05 #2

P: n/a
TC
In your code, PrtPort should be a string variable containing the relevent
parallel port device name, eg. "LPT1:". That should definitely open that
port. What is in your PrtPort variable? What leads you to say that the LPT
port "does not initialize"?

HTH,
TC
"Uros" <fl****@hotmail.com> wrote in message
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č

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.