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

Saving (or not saving) the current printer in a Report 2

Status
Not open for further replies.

ChrisCarroll

Programmer
Oct 10, 2000
177
I just discovered- by way of a customer who's report refused to print- that FPW 2.6 saves your current printer name and setup, when you save the report, even if you didn't ask it to.

In this instance, it saved "LaserJet 4 on LPT3". So, customer tried to print the report - his windows default printer is a LaserJet 3 on LPT1 - and it comes out of LPT3 formatted for a LaserJet 4. Not helpful - he doesn't have a LaserJet 4 on LPT3.

Ways to get round this are:
1) Save the report with the printer setup the customer will use.
But this isn't an option because there's a lot of them using different setups

2) Use Report To Printer Prompt to force the print setup dialog to appear.
But I don't want to do this because I want to print a series of a dozen reports taking over half an hour and don't want customer to have to sit OKing the printer prompt for every report.

What I want, is to have one print setup dialog come up before the report prints [ sys(1037) ] and then have that setting apply to the following dozen reports. But it don't seem to work that way.
Any ideas?

 
What I tend to do is:
Develop 1 Dialog screen which allows the users to select
from a list of available printers (both local and networked). These defaults are then stored indefinitely until the dialog screen is re-selected and changed by the user. Behing the scenes, set the port of the printer
ie. Set printer to LPT1, plus any other attributes you may wish to offer in this dialogue (i.e. bold, summary reports).
A DBF could be set up to store the defaults, or alternaticely you could allow the FOXUSER.DBF to be updated from its' environment.

Now all future reports can use the stored defaults through
Macro substitution

i,e REPORT FORM myreport &PREVIEW &SUMMARY

Hope this helps..
 
Save a copy of your report data files (Copy xxxx.fr* to c:\a_save_dir\xxxx.fr*)
Use the xxx.FRX file
locate for objtype = 1
fields TAG and TAG2 holds the printer name
try deleting the info in these 2 fields.
Close the table
Attrib the file with +r
run the report
this should force the system to use the systems default printer and prevent it from writing that printer name back into the database.
This is pure theory, do not know if it will work. David W. Grewe
Dave@internationalbid.com
ICQ VFP ActiveList #46145644
 
Addendum to dgrewe's post: TAG and TAG2 holds printer name and these memo fields can safely be emptied. The EXPR memo also holds the printer name, along with other settings such as tray number, print quality, paper type, orientation, etc. You can write a little routine to remove the obnoxious "defaults" of printer name being stored in the report, or just remove them manually each time use save the report. If you want to use printer defaults for orientation, paper type, etc., you can safely empty out the EXPR memo. If you want to use the report settings for these, just remove the lines that specify the printer by doing the following:
After doing a LOCATE FOR objtype = 1, open up the EXPR memo and remove the lines that contain:

DEVICE=some_printer_name
OUTPUT=some_network_printer_name

Close the EXPR memo edit and do the following:

REPLACE TAG WITH ''
REPLACE TAG2 WITH ''
 
Thanks for the Responses.

FoxAI: Either I haven't understood you, or my problem is that "These defaults are then stored indefinitely" is precisely what doesn't happen: "Report Form" seems to just ignores the print setup defaults. And I don't know of a behind the seens way to read the windows default printer setup and force "Report form" to use it.


I stumbled across the
Code:
Tag
&
Code:
Tag2
fields - and guess what happens when you clear them?? When you execute
Code:
Report Form ... to printer
FoxPro actually pops up the printer dialog, as if you'd done
Code:
Report form ... to printer prompt
:-(

I haven't looked at
Code:
Expr
yet - thanks, I'll look at it when I get into work in the morning.

 
... interesting. As far as I can tell:

Irrespective of what's in Expr, if Tag & Tag2 are blank, the printer dialog box will [bold]always[/bold] pop up -
(What I was typing in Expr was:
Code:
OUTPUT=HP LaserJet IIID LPT3
DEVICE=LPT3:
which is one of my network printers ) -
so there seems to be no way to get Report Form to use the windows default printer - It will always either use the stored printer, or throw up a prompt on the spot?

Maybe this leaves me with
Code:
Keyb Chr(13) Clear
Report form printer prompt
as the best solution?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top