>One thing you absolutely do not want to do is add a UDF to a SQL query. VFP will run the UDF with every row of the source cursor, which KILLS performance.
I tried a UDF that deleted records. I thought that placing the UDF after another condition (with AND) would make it run only if the other conditions returned .T. Wrong!
Fortunately, I didn't try this with production data.
What I finally ended up doing is use the subquery approach to get me the PK of each record, and then send the PK to my UDF.
Hilmar.
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)