Microsoft KB Archive/155463

= BUG: Report Preview with Form's Name Clears Object Reference =

Article ID: 155463

Article Last Modified on 5/10/2003

-

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

-



This article was previously published under Q155463



SYMPTOMS
Issuing a REPORT FORM PREVIEW command on a report that has the same file name as a form that is running causes the form to lose its object reference. If you attempt to reference the form object in code, this error message appears:

Object not found



WORKAROUND
If you have a form called Customer and issue the following command, an object reference named Customer is created for the form: DO FORM Customer Preview a report named Customer by issuing the following command: REPORT FORM Customer PREVIEW The customer object now references the Report Preview window. When the Report Preview window is closed, the customer object is released. Work around this problem by giving your forms a different object reference than the reports with the same name. Do this by using the NAME clause in the DO FORM command. For example, to give the Customer Form an object reference of Custform, you would issue the following command: DO FORM Customer NAME Custform



STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.



Steps to Reproduce Problem
 Create a report using the Customer.dbf file in the Vfp\Samples\Data folder. Save the report as Customer. Create a new form. Add two command buttons to the form.  In the Click event of the first command button, add the following code: Customer.Caption = "Change Me"   In the Click event of the second command button, add the following code: REPORT FORM Customer PREVIEW </li> Save the form as Customer.</li> Run the Customer form and click the first command button, then click the second command button.</li> Close the Print Preview window and then click the first command button again.</li></ol>

Additional query words: kbvfp300 kbvfp300b kbvfp500 kbvfp500a kbvfp600 kbvfp300bug kbvfp300bbug kbvfp500bug kbvfp500abug kbvfp600bug

Keywords: kbbug kbprogramming kbother kbdisplay KB155463

-

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

© Microsoft Corporation. All rights reserved.