Microsoft KB Archive/256156

= A report that is transported from FoxPro 2.x for MS-DOS causes problems in Visual FoxPro =

Article ID: 256156

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft Visual FoxPro 7.0 Professional Edition
 * Microsoft Visual FoxPro 8.0 Professional Edition

-



This article was previously published under Q256156



SYMPTOMS
A report is originally created in FoxPro for MS-DOS and is transported to Microsoft Visual FoxPro. The report is problematic, possibly causing Visual FoxPro to crash or the system performance to degrade when it is run.



CAUSE
The report writer in Microsoft FoxPro for MS-DOS contains an interface that allows the developer to select a style for printing a selected field. The interface inputs values in a memo field of the report (.frx) called "style." Values that the interface can input are:
 * B - for Bold print
 * I - for Italic print
 * U - for Underlined print
 * R - for Raised face (Superscript) print
 * L - for Lowered face (Subscript) print
 * J - for right Justified print alignment
 * C - for Centered print alignment

In the event that a report .frx file contains any style code or codes other than those listed above, the report can cause system problems when it is transported to Microsoft Windows and edited within or run from Visual FoxPro.



RESOLUTION
Any style codes other than those listed in the "Cause" section of this article should be removed.



STATUS
Visual FoxPro for Windows adds additional fields to a report .frx file that store font and formatting information. For this reason, the report writer of Visual FoxPro does not utilize the style field of the report .frx file. However, the style field is present for backward compatibility and Visual FoxPro does read the style field (and all the .frx file information) when:
 * Saving a modified report
 * Closing a report in design mode
 * Rendering a report at run time

One particular activity that demonstrates the adverse impact of the unexpected style information is to copy objects (copying to and pasting from the clipboard) from one report to another. After this is done, close one report and then the other. This step might need to be repeated two or three times and then the following error can occur:

The instruction at "memory address" referenced memory at "memory address". The memory could not be "written".

After this message is displayed, Visual FoxPro shuts down.

A number of third-party products are available as extensions to the FoxPro for MS-DOS report writer. These usually come with PDSETUP (Printer Driver Setup) information that allows for printing special character sets (such as bar codes, and so forth) in MS-DOS. These can input values in the style field of the report .frx file that are not listed in the "Cause" section of this article.



Steps to Reproduce Behavior
It is important that the following steps not be performed in a session of Visual FoxPro where important information has not been saved and closed. It is best to perform this in a newly started session of Visual FoxPro.

To reproduce this behavior, perform the following:  Within Microsoft Visual FoxPro, open a sample table. Do not use a working table. From the File menu, select New, select the Report button, and click the New File button. Within the report writer, click the Report menu, and then select Quick Report. Deselect Add table to data environment, choose the vertical Field Layout, and then click OK. Close and save the report as Test1.  In the Command window, do the following to add a "T" to the style field for the top-most two report objects: USE test1.frx REPLACE style WITH "T" FOR RECNO > 4 AND RECNO < 7 USE && closes the test1.frx CREATE REPORT test2.frx &&for the copy and paste operation </li> While the test2 report is still open, open the test1 report.</li> Select a number of objects in the test1 report, ensure that the top-most two objects are among them, and copy them to the clipboard.</li> Now select the test2 report and paste the objects into it.</li> Close and save the test2 report.</li> Close the test1 report. Repeat items 6 through 10 (if necessary) and note that an error occurs and Visual FoxPro shuts down.</li></ol>

Keywords: kbprb kbreportwriter KB256156

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.