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

Preview a Report / Select a Printer

Status
Not open for further replies.

rickitikitavi

Programmer
Jul 23, 2008
6
US
I have recently discovered a problem with assigning a default printer using the GETPRINTER() function. FYI, I am running Windows Vista and VFP 6. On my computer, all printed output from a VFP report is being sent to the same printer regardless of what printer is set in Vista as the default printer or what printer is set using the GETPRINTER() function. This problem has just recently appeared and I suspect that a Vista update may have caused it and have reported such to Microsoft. However, I need a fix now for my users.

There was a previous thread about setting the printer from within a previewed report by issuing a SYS(1037) function immediately before outputting the report for review. This works perfectly. However, I was wondering if it was possible for this function to automatically occur if the user selects the print icon on the preview page rather than having to press a function key? It would be much more convenient for the user if this could be implemented.

Any assistance greatly appreciated.
Rick


 
Not exactly. I would like to bring up the report for review only (REPORT FORM ... NEXT 1 PREVIEW NOCONSOLE) and only when the user presses the "print" button on the report toolbar prompt them for a printer selection.

Can this be done?

Rick


 
You would have to go the route of doing a custom print/preview toolbar and selecting it by changing the resource file to one that uses the customer toolbar. There are threads and FAQ's on this subject. Since I don't like relying on a resource file I chose to create a control group class that has Preview, Print, and Printer Select buttons as well as a display label that I populate with the currently selected printer. I can therefore drop this control group class onto any form that prints anything.

Andy Snyder
SnyAc Software Services Hyperware Inc. a division of AmTech Software
 
"a VFP report is being sent to the same printer regardless of what printer is set in Vista as the default printer or what printer is set using the GETPRINTER() function."

The first thing which comes to mind with symptoms like this is - have you 'hacked' your Report Form data table to remove any inherited printer settings?

Code:
cReportForm = "C:\Temp\MyReport.frx"
USE (cReportForm) IN 0 ALIAS Rpt
SELECT Rpt
REPLACE Expr WITH "",;
   TAG WITH "".'
   TAG2 WITH "";
   FOR RECNO() = 1
USE

Good Luck,
JRB-Bldr
 
Rick,

Mike Gagnon has given you the correct answer.

You said you want to " ... bring up the report for [p]review ... and only when the user presses the "print" button on the report toolbar prompt them for a printer selection."

That's exactly what report form .... to printer prompt preview does.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
I should have mentioned in my previous post that I have tried using the command line REPORT FORM ... NEXT 1 TO PRINTER PROMPT PREVIEW NOCONSOLE. When the user selects the "Print" button in the report toolbar the output is immediately sent to the printer without the user being prompted for a printer selection. If I set up the F12 key to use the SYS(1037) function and the user presses F12 while the report is displayed for review, a prompt for a printer selection is displayed and the report is sent to the selected printer.

What I would like to do is issue the SYS(1037) function automatically when the user presses the "Print" button on the report toolbar.

Rick
 
I have tried using the command line REPORT FORM ... NEXT 1 TO PRINTER PROMPT PREVIEW NOCONSOLE. When the user selects the "Print" button in the report toolbar the output is immediately sent to the printer without the user being prompted for a printer selection.

That's not what I'm seeing. I have used this command many times, and I always see the printer dialogue when the user presses the Print button.

I can only think that the problem is caused by the printer driver information being embedded in the FRX file. If that's the case, see faq184-581 for information about how to remove it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Thank you JRB-Bldr!

I had hacked the report form earlier to remove only the printer information from the Expr field (I wanted all the paper information retained) but I did not hack the Tag and Tag2 fields. Leaving the paper information in the Expr field, I cleared the values in the Tag and Tag2 fields and the report was sent to the correct default printer. I assume that if I do this for the remaining reports they will also be sent to the correct printer.

Thanks to all for you replies and suggestions. They were greatly appreciated.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top