>I have produced a query which relates two tables, aircraft and pilots.
>In some cases there are no pilots who meet the condition PILOTS.PI_SEQ_NO=POLCOUNT. When this happens nothing is stored in the resultant cursor. Here is the query
>
>SELECT *;
> FROM RFQCURSOR LEFT OUTER JOIN YELLOW1!PILOTS;
> ON RFQCURSOR.NNUMBER_A=PILOTS.NNUMBER;
> WHERE PILOTS.PI_SEQ_NO=POLCOUNT;
> INTO CURSOR RFQCURSOR NOFILTER
>
>If there are no pilots I would like the query to keep the old contents of rfqcursor, Anyone have any ideas how to proceed.
Thomas, I am not sure why you are not getting Error 1815
("cursor" must be created with SELECT ... INTO TABLE ) if you do SELECT from your cursor into the same cursor, I never do that in the first place, but if it works and it is really what you need, you may try do it in two steps:
SELECT *;
FROM RFQCURSOR LEFT OUTER JOIN YELLOW1!PILOTS;
ON RFQCURSOR.NNUMBER_A=PILOTS.NNUMBER;
WHERE PILOTS.PI_SEQ_NO=POLCOUNT;
TO SCREEN NOCONSOLE
IF _tally >0 && there are pilots
SELECT *;
FROM RFQCURSOR LEFT OUTER JOIN YELLOW1!PILOTS;
ON RFQCURSOR.NNUMBER_A=PILOTS.NNUMBER;
WHERE PILOTS.PI_SEQ_NO=POLCOUNT;
INTO CURSOR RFQCURSOR NOFILTER
ENDIF
so if there are no pilots your old cursor stays.
But I personally would rethink the whole thing... :)
HTH,
Nick
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro
"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison