Microsoft KB Archive/161185

= FIX: Report calling custom method returns incorrect information =

Article ID: 161185

Article Last Modified on 2/11/2005

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition

-



This article was previously published under Q161185



SYMPTOMS
A report that calls a function defined in a custom class prints the information incorrectly. However, in preview mode, values from the custom class appear correctly.



RESOLUTION
Place the Date function directly in the Expression box of the text box or use a user-defined function (UDF) to return the desired value.



STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem has been fixed in Visual FoxPro 5.0a.



MORE INFORMATION
The example below defines a custom class that returns a character string and the system date. If the report is previewed, the date appears correctly. Printing the report, however, causes the date value to appear as a logical value (.T.). The behavior does not occur in Visual FoxPro 3.0b.

Steps to Reproduce Behavior
 Create a report called Ztest.frx. Place the Customer table from the Testdata database, located in the \Vfp5\Samples\Data\ folder, in the DataEnvironment. Place two text boxes in the report. In the Expression box of the first text box, type oTest.cUser. In the Expression box of the second text box, type oTest.dToday. Close and save the report.  Create a program containing the following code: oTest = CREATEOBJECT("Test") ? oTest.cUser ? oTest.dToday * REPORT FORM ztest RECORD 3 TO PRINTER REPORT FORM ztest PREVIEW

DEFINE CLASS test AS CUSTOM cUser = "Testing" FUNCTION dToday RETURN DATE ENDFUNCTION ENDDEFINE  Run the program and note that the date appears correctly. Close the Preview window. Open the program and remove the asterisk (*) from the first REPORT FORM command, and place and asterisk in front of the second REPORT FORM command. The asterisk character comments out individual lines of code. Run the program and note that the printed report displays ".T." where the date should be.</li></ol>

NOTE: Printing the report from the Preview Toolbar in Step 4 also illustrates the problem.

Keywords: kbbug kbfix kbvfp500afix kbprogramming KB161185

-

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

© Microsoft Corporation. All rights reserved.