Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SET PRINTER TO NAME command
Message
From
30/11/2011 16:53:10
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01530038
Message ID:
01530042
Views:
97
>We are really struggling here with error 1957, "Error accessing printer spooler." This error has occurred with some regularity over the past year or so (which is as far back as I have error log data) but for some reason has spiked this month.
>
>The error occurs on the second line of code here:
>
>m.cLocalMachineName = UPPER(gaPrinters(i,1))
>SET PRINTER TO NAME (m.cLocalMachineName)
>
>I googled "foxpro set printer to name problems" and got some hits. Some were simple user error, for example not referencing the name as a name expression or macro substitution, but others lead me to question the reliability of the command. There was a discussion on "the other FoxPro forum" in 2009 in which the original poster was convinced there is a bug in VFP. He said the default printer is always used regardless of what SET PRINTER TO NAME sets it to. The suggestion was made to issue SET PRINTER TO DEFAULT first. I tried that and it didn't work. There was also a suggestion, which I will try, of changing the printer via a Windows call instead of doing it from VFP.
>
>The users and their managers are going a little batty over this. Any suggestions?

This may be too obvious, but make sure the Print Spooler service is running on the local machine. Check System Event Log(s) on various computer(s) to see if there have been any print-related errors.

If you have an unreliable network (e.g. wireless), and the printer is a network printer, a connection dropout might cause problems like that. Maybe you could compare reliability of a network printer vs. one that is locally attached, or a built-in one like the Microsoft XPS document writer or an installed PDF printer driver etc.

Some modern print devices (AIOs etc.) have complex driver software, sometimes with custom print monitors etc. If something is wrong with the driver software you could see symptoms such as you describe. To test for this, you could temporarily install a simple printer/driver combination (such as HP LaserJet 4), to a local port LPT1: (even if neither the printer nor the port actually exist), and test with that.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform