If no record fulfils the condition, i.e. if no record is selected,
the cursor is not created in the first place. Worse yet, you may have no-longer-valid data from a previous run of the loop.
That's why I second Hugo's idea, to use _tally, which will always work (and be equal to zero if no records are selected):
select ...
llIsKit = _tally > 0
>Any guesses on how an alias can disappear?
>
>I have the following:
>
> SELECT * FROM components INTO CURSOR MyComponents ;
> WHERE KitID==lcPartNo
> llIskit = 0<RECCOUNT("MyComponents")
>
>This is in a loop that is executed a few thousand times. On rare occasions, the second line fails with "alias not found" ... and when this occurs, ALIAS() is empty! That's right, I get a cursor with NO alias.
>
>Any guesses on how to get around this? (No, it's not as easy as doing RECCOUNT() -later on, having done various and sundry other things with other SELECT statements, I need to get back to this alias --)
>
>Thanks
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)