Print from VBA in ACCESS 97

B

Bill

Using this code (example) works the first time I open
Access...

Open "LPT1" For Output As #1
Print #1, Chr(10)
Print #1, Chr(10)
Print #1, Chr(10)
Print #1, Chr(10)
Print #1, Chr(10)
Print #1, Chr(13)
Print #1, Chr(15); Spc(22); "6455-101"
Print #1, Chr(12)
Close #1

The next time I open Access I get this error...

"Path/File access error"
Any ideas why??
 
D

Douglas J. Steele

I've got no experience writing the LPT1: from Access, but your problem could
be the fact that you've hard-coded the file handle as 1.

Try:

Dim intFile As Integer

intFile = FreeFile()

Open "LPT1" For Output As #intFile
Print #intFile, Chr(10)
Print #intFile, Chr(10)
Print #intFile, Chr(10)
Print #intFile, Chr(10)
Print #intFile, Chr(10)
Print #intFile, Chr(13)
Print #intFile, Chr(15); Spc(22); "6455-101"
Print #intFile, Chr(12)
Close #intFile
 
G

Guest

Thanks for the reply, but still get the same error. If it
makes a difference I'm running Access 97 on an XP laptop.
Using Access 97 because we have so many old Access
databases and haven't the time to go back and convert them
all. Again, thanks for the try.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top