Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing to specific printer

Status
Not open for further replies.

SytzedeBoer

Programmer
Apr 1, 2013
15
0
0
NZ
Client has a small app to capture client purchase orders
This capture can happen in a large building with multiple pc's and phones.
When he/she captures the order, the order is printed on a specific choice of printer
So my system goes
trcask122=''
trcask123=''
trcask124=1
mypr=APRINTERS(gaPrn)
FOR i=1 TO mypr
trcask122=trcask122+gaprn(i,1)+","
ENDFOR
do form windpslp && Combo, to choose the printer and number of copies
IF !EMPTY(trcask123)
SET PRINTER TO NAME (trcask123)
endif
FOR i=1 TO trcask124
Report Form (winreport) To Print nocons
ENDFOR

This is very basic stuff, I would have thought, BUT, I keep getting
Error accessing printer spooler

When I do this at my place, no problem if i print to a local printer
No problem if I embed the network printer in with the Report, and set printer environment on
(This is not a practical solution)
Can anyone offer any suggestions ?
 
I have found a workaround by using FoxyPreviwer.
I had avoided using that thinking it was too many clicks/keystrokes, but really, I should have used it from the beginning.
It still beats me why the routine didn't work with the "set print to name (name)"

 
I have found a workaround by using FoxyPreviwer.

That seems a heavy-handed approach. It would have been simpler to use GETPRINTER(), or - as Dave suggested - the PROMPT clause in your REPORT FORM.

In any case, finding a workaround is all very well, but it would have been useful to solve the original problem - if only so you know what to do if a similar problem comes up again. In this case, at the very least I would have checked the value of trcask123 after running the windpslp form. Since we don't know anything about that form, it would be the first thing I would suspect as the source of the problem.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Spaces in names are not a problem.

lcPrintername = "Microsoft XPS Document Writer"
Set printer to name (lcPrintername)

Have you asked users what printer they choose? Not all printers are as easy set via SET PRINTER TO NAME. So I think the problem is in APRINTERS result.

I assume the you use the trcask122 variable in the windpslp form to populate a combo to choose from. You could simply use GETPRINTER() here.

Populating a list opf printer names with trcask122 = trcask122+gaprn(i,1)+"," is hoping no printer has a comma in i's name. I also assume there are problematic entires with LPT or COM as ports not really available for printing.

And last not least there might be printer ino in the FRX not working with your override. If you specifically SET PRINTER your FRXes should not have embedded printer info in them.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top