Nadya,
I just singled out substr(), any string function can fail in this way under VFP5.
I'll bet the error is here:
lcSourceTbl=lcState+"SAL"+right(lcYear,2)
What is the value of lcYear when the code tries to run?
>I'm sure, I didn't do such a thing!!!! :)
>This is my lcWhere expression: (from debugger)
>ccode='13' and aa.ccode+aa.town=bb.County+bb.town
>
>No substr at all...