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

report has printer defined within page setup, but doesnt print 1

Status
Not open for further replies.

CMcC

Programmer
Feb 5, 2002
196
US
Hi all.
Have something that Ive put off for a while that is bugging me. I have created 'letters' that print in a loop defined by date.
Inside these letters I have a specific network printer assigned within the page setup of the report form.
I had tested with printer PROMPT just to see if it would bring the printer selection with the specific printer selected and it does...works perfectly with the PROMPT keyword in place - brings up the printer prompt with the specific printer selected...I select to print and it prints to the network printer.

Problem comes when I take the PROMPT out...says that the letters are printing, but nothing prints.
Anyone had this problem before? Using VFP 7.
Thanks
 
You are MUCH better off by eliminating the printer being defined within the Report Form.

Code:
cReportForm = "F:\MyApp\Reports\MyReport.frx"
USE (cReportForm) IN 0 ALIAS Rpt
SELECT Rpt
REPLACE expr WITH "", Tag WITH "", Tag2 WITH "" FOR RECNO() = 1
USE

You can write code to select the appropriate default printer and/or allow the user to choose the desired printer prior to sending the data to the Report Form.

In this way you are not depending on parameters which may or may not be supported on an individual's workstation.

Good Luck
JRB-Bldr
 
Hi jrbbldr. So if I took the specific printer out of the report form table, would you have them select a printer by
Code:
set printer to getprinter()
then call the report form by
Code:
report form reportname to printer noconsole?
The reason I have the printer in the report table is so that when I prompt for individual letters (reports), the appropriate printer is highlighted. (Users can have up to 10 printers that they can print to- so I have it where they just have to hit enter when the printer selection pops up). This works for individual letters, but the auto feature that loops through and prints by date, I dont want the user to have to hit 'enter' for each letter. It should do it on its own.
thanks a bunch


Thanks for your response.

Cmcc
 
I think to accomplish this you'll need to hack the frx when you print multiples, then prompt once with getprinter().
An application I work on and support does this by copying the frx and frt files to temporary files and hacking them to remove the printer stamp, then printing the report using the temporary report format.

Andy Snyder
SnyAc Software Services Hyperware Inc. a division of AmTech Software
 
"Users can have up to 10 printers that they can print to"

Their Windows should 'know' about the printers each workstation has available.

Code:
* --- Use APRINTERS() To Determine What Printers Available ---
=APRINTERS(gaPrinters)

Assuming that you have a reference table containing the preferred printer for each 'report', then you can use something like above to examine the gaPrinters array and determine if the intended printer is 'available' to the specific workstation.

If it is available, create code to select it and use it with no user intervention required.

If the desired printer is not available, have your code request input from the user to select a different printer.

While it can be done in a variety of ways, I use code like below to temporarily change the Windows default printer to a pre-defined one (defined by Name) and, when done, restore the original one.

Code:
* --- Determine Existing Default Windows Printer ---
lcDefaultPrinter =  SET("PRINTER",2)

* --- Use Windows Scripting To Set Default Printer ---
lcNewPrinter = "DesiredPrinterByName"
ONET = CREATEOBJECT("WScript.Network")
ONET.SetDefaultPrinter(lcNewPrinter)

SET PRINTER TO NAME (lcNewPrinter)

<Do Whatever>

* --- When Done Printing - Use Windows Scripting To Restore Original Default Printer ---
ONET.SetDefaultPrinter(lcDefaultPrinter)
RELEASE ONET

SET PRINTER TO NAME (lcDefaultPrinter)

Good Luck
JRB-Bldr
 
I will definitely give it a try. Thank you so much for your assistance.
Cmcc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top