Probably it is because of the "order by" the field not included into select.
See
http://support.microsoft.com/default.aspx?scid=kb;en-us;125324Anyway, try to exclude where conditions one by one to see whether it behaves properly on each attempt.
>This is the actual query Yuri.
>
>LcSQL = [select distinct(a.tiffile), b.docindex_i from ocrdata a,docudeck b ;
>where a.tiffile = b.file_name ;
>And a.OCDATA like "%] + alltrim(thisform.text5.value) + [%" ;
>Order By a.ID into Cursor lcSource]