>It's just a guess but It looks like VFP SQL Engine "hides" original cursor in order to allow creation of a cursor with the same name.
>Can you post the real query?
>
lcReturn = thisform.odata.Get_RMA_Status_By_Customer(ldteStart, lDteEnd, lcCustomer, lcStatus)
SELECT * FROM (lcReturn) ;
WHERE rma_no IN (SELECT rma_no FROM (lcReturn);
WHERE activity = "Passed - waiting for source" ;
AND EMPTY(date_end)) ;
INTO CURSOR (lcReturn)
etc
It seems to be the combination of the same cursor for the FROM, IN, and INTO portions of the query. Several variants worked quite well.
I also tried putting the actual cursor name, rather than the variable reference, into the query and got the same error.
FWIW, I get the same error using VFP 9
I have alternatives which are working so this is not a big issue for me. I was, and still am, curious as to what might be happening within VFP to cause this problem.
Thanks for any insight
.........Rich
>
>>We have a module which creates a cursor and then returns its name. I need to further refine the selection but I'm getting an error that I'm hoping somebody here can explain.
>>myCursor = thisform.get_some_date(params)
>>this code works
>>SELECT * from (myCursor) WHERE id IN ;
>> (SELECT id FROM (myCursor) WHERE condition);
>> INTO CURSOR DifferentName
>>
>>but this code
>>SELECT * from (myCursor) WHERE id IN ;
>> (SELECT id FROM (myCursor) WHERE condition);
>> INTO CURSOR (myCursor)
>>
>>generates the Open Table dialog and then an error because it can't find the cursor (myCursor).
>>
>>It also works if I code it as
>>SELECT id FROM (myCursor) WHERE condition INTO CURSOR curHold
>>SELECT * FROM (myCursor) src;
>> JOIN curHold ch ON ch.id = src.id;
>> INTO CURSOR (myCursor)
>>
>>I'm curious as to what causes MyCursor to close when using it for the FROM, IN( ), and INTO CURSOR.
>>
>>Any thoughts appreciated.