Check that your function really returns to the previous work area. I am not sure about select(0), and I don't have VFP handy to check the help file; I always use select() to store the work area.
Also, why would the function end with RETURN .T.? It should return .T. or .F., depending on some condition. If you do RETURN .T. in the place marked with "*-- Som something", perhaps you are forgetting to return to the previous work area.
>Hi,
>I have a SQL statement that call my UDF. In the UDF, I have code to LOCATE the result as following.
>
>
>SELECT * FROM mytable WHERE myUDF() INTO CURSOR myresult
>
>FUNCTION myUDF()
> *-- Some codes...
>
> IF myCondition
> lnWrk = SELECT(0)
> SELECT myresult
> LOCATE FOR condition1
> IF FOUND()
> *-- Som something
> ENDIF
>
> SELECT (lnWrk)
> ENDIF
>
> RETURN .T.
>ENDFUNC
>
>
>
>VFP returns empty record in result cursor for those records which match mtCondition.
>
>Any ideas?
>
>Thank you
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)