Do you have spaces in the path?
Shouln't you open index first with ?
SET INDEX TO ...
>I have a grid in which I allow the user to click on the column header to set the order ascending or descending. I have a method to create an IDX file on the fly. In it I create a string containing the index command - something like:
>
>lcIndexCmd = "INDEX ON UPPER(TRANSFORM(" + JUSTEXT(toHeader.Parent.ControlSource) + ")) TO " + m.lcIDXName + " COMPACT"
>
>where toHeader is an object reference to the actual header that got clicked and m.lcIDXName is the name of the IDX file I'm going to create.
>
>I then issue a macro like, &lcIndexCmd. to create the IDX file. Next I do another macro command to "SET ORDER TO " + m.lcIDXName
>
>If I set m.lcIDXName = "_Temp" and run the code, things work fine. The index is created and the order is set. The issue I'm having is, if I set m.lcIDXName = "c:\SomeFolder\SomeSubfolder\_Temp" the macro to set the order crashes with "Command contains unrecognized phrase/keyword".
>
>The only thing that I can see that causes this error is the fact that the index name cannot have a full path and will only take a filename.
>
>Can anyone confirm this or anyone experience this?
>
>TIA
>Mike
--sb--