Thanks Sergey. Using ATAGINFO() worked for me.
>Mike,
>
>If you run ATAGINFFO() and examine the first column (Tag/Index name), you'll see that for IDX file it's IDX file name (w/o) extension. That's what you should use in the SET ORDER TO command.
>
>SET ORDER TO (JUSTSTEM(m.lcIDXName))
>
>
>>
>>I have no spaces in the path. In fact, if I set m.lcIDXName = "c:\_Temp" it still causes the error.
>>
>>Interestingly enough, if I use use SET INDEX TO... I can set the fullpath to the IDX file and not cause the error. The bad news is that my grid does not switch it's ascending/descending order when I SET ORDER TO...
>>
>>So to make this work for me, I need to set m.lcIDXName = "somevalidfilename" and not include the path. I've tried the other commands like SET INDEX TO... then SET ORDER TO... and they all generate the same error if I specify the fullpath to the idx file. Weird.