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

How to: print reports with irregular form length to different printers 1

Status
Not open for further replies.

kimsue

Programmer
Mar 5, 2002
52
US
I have an application that prints custom reports (purchase orders and vouchers in particular). Most of these reports have irregular lengths (7", 8 1/2" etc.). I realize that the printer and paper type will default to the ones I select when I create the report IF the user is using the EXACT printer name I have selected, but can anyone tell me how I can allow the user to select a printer and have the correct paper type defaulted for different reports? I am attempting to solve the problem by creating a form that saves the correct printer for each report by using the GETPRINTER() command, but I can't seem to get the correct printer/paper length defaulted at the user's site. In the older versions of Foxpro (2.6), I believe I just selected CUSTOM as the Paper Size and it would default correctly.
I have set up Custom Form Lengths at the user sites for each of their forms. Any help would be appreciated. Thanks.
 

If you have created the proper sizes in the printer driver of the user, do the same on the development box, save the information in the report, and you shouldn't have to get the user to select the size, it should work automatically.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
I have used the getprinter() command to allow the user to select the Printer Name to be used as the default for a custom report. I save the Printer Name and use the SET PRINTER TO (saved printer name) prior to running the custom report. It still defaults to the default windows printer rather than the saved printer name. Any suggestions? Thanks.
 
If you allow the user to select a printer, does he know which printer has the custom setting?

1. I would suggest you clear the printer information for the fields in your report that gets saved when you last modified the report. Take a look at faq184-581
2. Worst comes to worst you can force a default windows printer change and put back after he printed the report.
Code:
lcPrinter = GetPrinter()
oNet = CreateObject('WScript.Network')    
oNet.SetDefaultPrinter(lcPrinter)



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
OK, if I issue the command:

SET PRINTER TO NAME (saved printer name)

and remove all contents of the memo fields... EXPR, TAG and TAG2 from the FIRST record of the FRX file....

USE xxxxxxx.frx
BROWSE FIELDS expr,tag,tag2

*** remove contents of the memo fields of 1st record and save

I am able to get the report to default to the printer the user has previously selected as the DEFAULT PRINTER for that particular report. I am assuming if user has selected a particular paper type (with the correct length)for that printer, the form will print correctly.

I'll let you know if this DOES NOT work.

If anyone knows a better way to handle this, please let me know. Thanks:)

 
Thanks, Mike. I saw your response after I entered mine. The FAQ (setfrx.prg) saved me a lot of time :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top