>>I had a situation with a method which executes the following code
>>SELECT rpt.*,inv.u_of_meas ;
>> FROM crsReport rpt ;
>> LEFT JOIN inventor inv ON rpt.uniq_key = inv.uniq_key;
>> INTO CURSOR crsReport READWRITE
>>
>>REPORT FORM reports\pick_by_seq TO PRINTER PROMPT PREVIEW NOCONSOLE
>>
>>I was getting a "Variable Not Found" error.
>>
>>I checked and the current ALIAS() was crsSchedule.
>>So I put in an explicit
>>SELECT crsReport
>>immediately after the Select statement.
>>
>>"Variable Not Found".............
>>
>>I was aware of situations where the Report Writer is not happy when focus is on a grid so I made the first line of the method
>>thisform.txtBuild.setFocus
>>
>>This solved the problem until yesterday. I had re-compiled the app and the problem re-surfaced. Immediately after the SELECT SQL statement the active cursor was no longer the one specified by the INTO CURSOR claus.
>>
>>I changed the SETFOCUS() at the beginning of the method from the TextBox to a Command Button and all was well again.
>>
>>Does anybody have an explanation of why the INTO CURSOR does not become the active work area?
>>
>>Absent an explanation of why.......is there something that lists the conditions which could cause this situation?
>
>The easiest way to figure out what's causing it is to put ALIAS() in the Watch window and set a breakpoint on it.
>
>Tamar
Putting the break point didn't help. But putting a series of WAIT WINDOW ALIAS() statements and a SET STEP ON pointed me to something new.
It actually goes back to a thread (one I started, I think) which became a discussion about leaving SET STEP ON in production code.
What I found is.............
WAIT WINDOW ALIAS() ----> crsReport
SELECT * FROM crsReport WHERE condition INTO CURSOR crsReport READWRITE
WAIT WINDOW ALIAS() ----> crsReport
SET STEP ON ----> ALIAS() becomes crsSchedule
The textbox to which I had setFocus has a controlsource which is the same controlsource as one of the fields in a grid. My guess is that this triggered the same set of problems as if the grid had had focus before I started the whole thing. My other guess is that SET STEP ON in an EXE is not ignored. It does whatever it would normally do the the VFP environment but doesn't bring up the debugger. It then continues executing the code.
So, Mike Y, I'm now a believer.
My thanks to all who offered suggestions.
.........Rich