Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Custom report dialogue will not print to selected printe
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01148925
Message ID:
01148927
Views:
17
This message has been marked as the solution to the initial question of the thread.
You not only don't need macro sunstitution but it can also cause a problem if priner name has spaces. The Name expression works much better.
...
lcPrinter = thisform.cboPrinter.value
SET PRINTER TO NAME (lcPrinter)
REPORT FORM (lcReport) TO PRINTER NOCONSOLE
>I have designed a custom printer selection form. I have populated the combo box with the printers as follows:
>
>lnPrtCnt = APRINTERS(gaPrinters)
>
>IF lnPrtCnt > 0
>   FOR i = 1 TO lnPrtCnt
>     this.AddItem(ALLTRIM(gaPrinters[i,1]))
>     IF UPPER(gaPrinters[i,1]) = lcPrinter
>        this.Value = gaPrinters[i,1]
>     ENDIF
>   ENDFOR
>ENDIF
>
>
>The print button contains the following code:
>
>lcReport = ???? * name of report that should be printed
>lcPrinter = thisform.cboPrinter.value
>
>SET PRINTER TO NAME &lcPrinter
>
>REPORT FORM &lcReport TO PRINTER
>
>
>However when the SET PRINTER code executes I get the following error:
>Error accessing printer spooler (Error 1957).
>
>if I run this code in the command window
>
>SET PRINTER TO NAME GETPRINTER( )
>
>and then call the REPORT FORM command I dont get an error and the report prints to the selected printer.
>
>How can I get my code to print to the selected printer.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform