This is a Visual FoxPro bug about printing a report designed with VFP6 and printed with VFP9
FoxPro Version: 9.0 sp1
Reproduces (pick one): always
Hardware and Software Details:
Using a local USB Printer Brother HL-2030
Other Development Environments? yes/no
Using my computer boss
Steps to Reproduce:
1. Create a report using VFP5.0/6.0 or Fox 2.5b. This process will assign at the setup of the report an default printer, like this:
2. Until (inclusive) version 6.0, if you execute the next code, the printeing will be redirected correctly to the specified printer by set printer to name MYPRINTER
Set printer to name MYPRINTER
Report form NAME noeject noconsole to printer
Set printer to default
3. Executing the same report/program compiling with Vfp9 (already using the default SET REPORTBEHAVIOR 80), the REPORT FORM omit the selected printer by SET PRINTER TO NAME MYPRINTER, it will print using the defined inside the report (look at the previous sample image, in my case the Brother printer).
ONLY with VFP9 and if you have in your computer installed the printer defined inside the report. If you copy this program and report to a computer without this printer, the program will work fine. Also works fine if you remove the printer in the computer affected with the problem.
HOW I SOLVED IT?
Modifying the file FRX and replacing the tag,tag2,expr fields with:
REPLACE ALL tag WITH “”,tag2 WITH “”,expr WITH “” FOR objtype=1 AND objcode=53
Solución alternativa de microsoft:
But, as for your VFP 9.0 Reports only saving the Printer Environment issue, if you have it unselected under the REPORTS menu, your reports will print to any printer that you set VFP to with the SET PRINTER TO NAME <printer name> command.
If you use the CREATE REPORT command to create reports on the fly, the Printer Environment does not get saved. If so, just delete the contents of the first record’s TAG and TAG2 fields in the FRX file by opening the report with USE myreport.FRX and deleting the contents in the TAG and TAG2 fields (first record only).
You may not want the report to save the table(s) in the Data Environment of the report, and if so, just use the code below to get rid of the information that is entered into the “NAME” and “EXPR” memo fields that have a OBJTYPE value of “26”.
SET SAFETY OFF
CLOSE TABLES ALL
USE Employee IN 0 SHARED
CREATE REPORT DE_Test2.FRX FROM Employee.dbf FIELDS first_name
USE DE_Test2.FRX IN 0 EXCLUSIVE
DELETE FOR objtype = 26
REPORT FORM DE_Test2.FRX PREVIEW