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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why 'set printer to name ..'? 1

Status
Not open for further replies.

alan232

Programmer
May 19, 2004
144
US
Hi All ;

After several hours I managed to get my report to correctly print on a printer that was neither the machine default nor the printer compiled with the report. But I am curious why I needed to include 'set printer to name ...' after already clearing the tag and tag2 and correctly reseting expr of the .frx file with the desired 'DEVICE=' and 'OUTPUT=' values. (According to the FAQ Mike so kindly wrote 5 years ago, I shouldn't have needed to use the set printer command--or so I thought???)

I'm using vfp 6 under windowsXP.

Thanks in advance for your help,
curious and confused,
Alan
 

Alan,

When you cleared out the FRX, you in effect specified that you wanted to use the VFP default printer. By default, the VFP default printer is the same as the Windows default printer. If you want to use a different printer, there are two options:

- Use SET PRINTER TO NAME. This will establish a new VFP default printer, which will apply to all reports subsequently printed in the current session.

- Use the PROMPT clause in the REPORT FORM command. This will affect that one command only, and will override the VFP default printer.

My FAQ is correct. You don't have to use SET PRINTER. You can either use the PROMPT clause, or stay with the default printer.

I hope this clarifies things.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Hi Mike;

Thanks. So...If the only thing I'm changing is the destination printer, I don't need to change the expr "Device=" and "Output=" at all? Just use 'set printer to name..." after clearing out the compiled code in tag and tag2?

Thanks much for your help,
Alan
 

Alan,

Well, actually you do need clear out the Expr field. The point is that the settings in Expr (and Tag and Tag2) will override all other printer settings (for that one report).

So, clear out Expr etc and execute SET PRINTER TO NAME. I think you'll fnd that'll work.

(By the way, clearing out Expr etc is much easier in VFP 9.0. I need to update the FAQ to reflect that.)

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Mike,

Thank you very much! I don't mean to beat a dead horse, but I can't get the settings in Expr (vfp6) to redirect to a different printer simply by setting "Device=" and "Output="--without also using 'set printer to name ...' i.e., I'm not sure how vfp 6 uses the declared settings in the expr field, but however it's used, it does not seem to activate the correct printer spool without 'set printer to name..' being used. This is a long way of saying, that it would appear that the expr field in vfp6 is ignored without tag and tag2, so why bother to clear it?

Thanks again for your help,
courious and confused,
Alan
 

Alan,

As I understand it, Expr contains the various settings in a plain text string, whereas Tag and Tag2 contain "compiled" versions of that string. During printing, VFP looks at Tag/Tag2 first. If it finds information in those fields, it will use it. If not, it will "compile" Expr and store the compiled version in Tag/Tag2.

I've also noticed that changing the Device field in Expr doesn't always change the target printer, but changing the other fields (like the DEFAULTSOURCE) does change the appropriate setting.

I'm not completely sure about any of this, but I think it's at roughly correct.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Hi Mike,

Thank you very very much! Printing under vfp has always been a little less then straighforward to me. I'm glad to see I'm not the only one with this problem.

Thanks again,
Alan

 
Didn't you also post the same question here about three months ago?

I did - and it's all coming back to me like a bad dream now. My only excuse is that it was late on a Friday afternoon after a bad week.

This btw was the same site who had the "INSERT" problem I mentioned in "General Coding".

Geoff Franklin
 

Geoff,

My only excuse is that it was late on a Friday afternoon after a bad week.

So what's your excuse for posting messages in a totally unrelated thread? Let's hope it's not Monday morning at the start of another bad week <g>.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top