Microsoft KB Archive/89235

{| = PRB: Screen Program (.SPR) May Run Itself in FoxPro =
 * width="100%"|

ID: Q89235

The information in this article applies to:


 * Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, and 2.5a
 * Microsoft FoxPro for Windows, versions 2.5 and 2.5a

SYMPTOMS
If a screen program (.SPR) contains a DO command that invokes a program with the same name as the screen program and the extension is not specified, the screen program will invoke itself. This problem may cause the following error messages to appear:


 * Too many READs in effect
 * DO nesting too deep

The same problem occurs if the WHEN clause for the field contains the same code (for example, DO checkit).

CAUSE
If the setup code for the screen contains this code, the &quot;DO nesting too deep&quot; message appears because the maximum of 32 DO commands has been exceeded and the SPR runs itself.

RESOLUTION
Include the extension of the program in the DO command. In the example above, type &quot;DO checkit.prg&quot; in the appropriate code sample. The program then executes correctly.

STATUS
This behavior is by design.

Steps to Reproduce Behavior
1. Use the screen generator to create a new screen.

2. In the VALID clause for one of the GET fields, type &quot;do checkit&quot;

(without the quotation marks). 3. Generate the screen program as CHECKIT.SPR. 4. In the Command window, type &quot;modify command checkit&quot;. In CHECKIT.PRG,

type the following command:

WAIT WINDOW &quot;I'm doing the PRG&quot; 5. DO the CHECKIT.SPR program. 6. After exiting the field with the VALID clause five times, the

following message is displayed

Too many READs in effect

because exiting the field invoked the VALID clause, which in turn restarted CHECKIT.SPR and created a new READ level. The error occurs because only five READ clauses can be in effect at any one time. Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a KBCategory: kbprg kbprb KBSubcategory: FxprgGeneral
 * }