DOCUMENT:Q121685  10-NOV-1994  [FOXPRO]
TITLE   :PRB: RETURN TO <Filename>.SPR Does Not Work in .APPs or .EXEs
PRODUCT :Microsoft FoxPro
PROD/VER:2.5x 2.60 2.60a
OPER/SYS:WINDOWS
KEYWORDS:kbprg

--------------------------------------------------------------------
The information in this article applies to:

 - Microsoft FoxPro for Windows, versions 2.5x, 2.6, 2.6a
--------------------------------------------------------------------

SYMPTOMS
========

The RETURN TO <filename>.SPR command does not work if it is executed within
an .APP or .EXE file.

WORKAROUND
==========

The RETURN TO <filename>.SPR command will work if it is changed to RETURN
TO <filename>.PRG. However, this method has a drawback: Every time you
modify and regenerate your screen (.SCX), you have to issue the RENAME
command to rename the newly generated screen to a .PRG file.

STATUS
======

Microsoft has confirmed this to be a problem in the Microsoft products
listed at the beginning of this article. We are researching this problem
and will post new information here in the Microsoft Knowledge Base as it
becomes available.

MORE INFORMATION
================

Steps to Reproduce Problem
--------------------------

 1. In the FoxPro Command window, issue the following command:

      MODIFY COMMAND MAIN

 2. Type the following code in MAIN.PRG and save it:

      ON ERROR DO errhand WITH ERROR( )
      DO test.spr    && GET field should cause an error

      PROCEDURE errhand
      PARAMETER merror
      WAIT WINDOW "Error occured: "+STR(merror)
      RETURN TO test.spr

 3. In the FoxPro Command window, issue the following command:

      CREATE SCREEN TEST

 5. Add an input field with M.CHOICE in the Input text box and the
    following code in the VALID clause:

      IF !EMPTY(m.choice)
         WAIT WINDOW "Something in field" && cause error to occur
      ENDIF

 6. Add a push button with OK as the prompt and the Terminate READ On
    Selection option selected. Enter any variable in the Variable text
    box.

 7. Save the screen.

 8. In the FoxPro Command window, issue the following command:

      CREATE PROJECT MYTEST

 9. Click the Add button to add MAIN.PRG as a Program type. FoxPro
    automatically mark MAIN.PRG as the main program.

10. Click the Add button again to add TEST.SCX as a Screen type.

11. Build an application called MYTEST.APP.

12. Run MYTEST.APP.

13. Type "123" (without the quotation marks) in the input field on the
   screen and press ENTER.

   Note that a WAIT window containing the text "Error occured: 16" will be
   displayed in the top-right corner. Press any key. RETURN TO TEST.SPR in
   the error routine will return to the Command window instead of to the
   OK button.

14. Run MAIN.PRG.

15. Repeat step 13.

Note that RETURN TO TEST.SPR returns to the OK button on the screen. The
READ is still active.

Additional reference words: FoxWin 2.50x 2.50 2.50a 2.50b 2.60 2.60a
KBCategory: kbprg
KBSubcategory:

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS
PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.  MICROSOFT DISCLAIMS
ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO
EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR
ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL,
CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF
MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.  SOME STATES DO NOT ALLOW THE EXCLUSION
OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES
SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1994.