Without going into detail, I advice you to NEVER, I repeat NEVER, use ALLTRIM() in an index expression, it's asking for problems! All index expressions MUST give a fixed length value!
>Would some try this sample code in VFP8, then again in VFP9? On my machine the both queries run optimized in VFP8, but only the 2nd one in VFP9. I don't know what settings to check other than ANSI and EXACT. Could it be a problem with VFP9?
>
>SET ANSI OFF
>SET EXACT ON
>CLEAR
>* Turn rushmore reporting on
>SYS(3054,2)
>* Create a test cursor
>CREATE CURSOR test (field C(10))
>INDEX on field TAG field
>INDEX on ALLTRIM(field) TAG field_t
>* Put some data in the cursor
>FOR i = 1 TO 10000
> INSERT INTO test VALUES (SYS(2015))
>ENDFOR
>* Determine the last value
>cValue = LEFT(test.field,LEN(ALLTRIM(test.field))-1)
>* Try the untrimmed index
>?"This one works"
>?"---------------------------------"
>SELECT * FROM test WHERE field = cValue INTO CURSOR index
>* Try the trimmed index
>?
>?"This one does not work"
>?"---------------------------------"
>SELECT * FROM test WHERE ALLTRIM(field) = cValue INTO CURSOR noindex