Nadya,
You could switch it to:
between(iif(extryear<'10','20','19')+extryear+extrweek, lcBeginWeek, lcEndWeek) as currmnth,
Even if it does turn out to be a bug in VFP5, it's inconsequential since that version is no longer being fixed. This all does work in VFP6 right?
> In the first SQL this line seems to cause the problem:
> between(iif(val(extryear)<10,'20','19')+extryear+extrweek, lcBeginWeek, lcEndWeek) as currmnth, because if I excluded it, it worked just fine. But why this line is problematic? Extryear is 2 characters field, like '99' or '00'.
>
> I used messagebox(lcWhere). I also opened debug and saw, that I had:
>lcWhere='aa.CCODE+aa.TOWN=bb.County+bb.TOWN', if I hardcoded these values. I think, this is enough to report a strange bug. I spent a whole Friday, testing this SQL and now I want to stop here.