>>>>>>>>>Hi,
>>>>>>>>>I have a printer on a Terminal services client installed in Windows Server 2003. I can print to it thru the regular Windows print command (File menu, then Print).
>>>>>>>>>However, when I try to set the printer in Foxpro, using SET PRINTER TO NAME //Servername/printername, it hangs for a few seconds and then returns an error msg "Error accessing printer spooler".
>>>>>>>>>FYI, I already set sharing permissions on the server's Windows/system32/spool directory, and I turned off all client firewalls (remember I can print when using the menu: File/Print command in any programs, including VFP). However, I need to code the printer selection without the user selecting.
>>>>>>>>>
>>>>>>>>>Can anyone help?
>>>>>>>>>Thanks,
>>>>>>>>>Allen
>>>>>>>>
>>>>>>>>If it prints correctly from VFP itself, then probably you have 'dirty' frx file. Make sure that Tag,Tag2 fields are empty, and Expr field doesn't have printer specific data.
>>>>>>>
>>>>>>>Hi Ed,
>>>>>>>Good to hear from you again.
>>>>>>>I'm not printing a report file. I am only trying the command SET PRINTER TO NAME ... in the command window. This will give an error. If I click the File menu, then Print in VFP or any other program, it works.
>>>>>>>I think it's a setting for Terminal Services that I'm unsure of. I don't know if Terminal Services allows direct access to the print spooler.
>>>>>>>Thanks,
>>>>>>>Allen
>>>>>>
>>>>>>What if you try: SET PRINTER TO GETPRINTER()
>>>>>
>>>>>It works if I select the printer from getprinter().
>>>>
>>>>So, just issue ?GetPrinter() from command window, see what's returned and use it in your code.
>>>
>>>I did that. Printed the results on screen, and it's exactly what I typed with the SET PRINTER TO NAME
command. I also put the results into a variable, and macro substituted to the SET PRINTER command, and it's too errors.
>>
>>May I ask a stupid question: if you put Set Printer To GetPrinter() in your code, do you get an error?
>
>No error. I guess this is a bug.
Not necessarily. Most likely, SET PRINTER TO NAME GETPRINTER() will still give an error. Could you try, please?
Edward Pikman
Independent Consultant