Connecting Tech Pros Worldwide Help | Site Map

Write to LPT

Uros
Guest
 
Posts: n/a
#1: Nov 12 '05
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š


Lyle Fairfield
Guest
 
Posts: n/a
#2: Nov 12 '05

re: Write to LPT


"Uros" <flaynb@hotmail.com> wrote in news:HZTGb.439$%x4.75061@news.siol.net:
[color=blue]
> 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š[/color]

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)
TC
Guest
 
Posts: n/a
#3: Nov 12 '05

re: Write to LPT


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" <flaynb@hotmail.com> wrote in message
news:HZTGb.439$%x4.75061@news.siol.net...[color=blue]
> Does anybody know how to write data directly to the LPT port from[/color]
MSAccess.[color=blue]
>
> 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š
>
>[/color]


Closed Thread