>>Can you provide the actual code for Myfunction?
>
>It is in my original message. I lowered it down to only have those lines.
IF ldDate and ldDate2 are declared as local than they are invisible in Myfunction and
SET FILTER TO CREATION>=ldDate AND CREATION <=ldDate2
became invalid. Foxpro evaluates filter only after pointer has been moved in table. That would explain why yoy get NOT EOF and EOF in Myfunction.
--sb--