FUNCTION SomeFunc LOCAL lnSelect lnSelect = SELECT( 0 ) && stores the currently selected work area * For straight opening of a table you can combine your 3 commands into 1: USE MyTable TAG MyCDXTag IN 0 && IN 0 means open the table in the next available empty work area * Do some SELECT into a cursor: SELECT * FROM SomeTable INTO CURSOR TempCursor * Do other stuff here * Cleanup: remember to close anything you opened: USE IN TempCursor USE IN MyTable SELECT ( lnSelect ) && go back to the work area selected before the function was called RETURN>I see now in the program where the cdx is called - as below.
>Select mydata >coldtag = Tag() >Set Order To Tag name >Locate For Substr(Alltrim(Upper(mydata.name)),1,.nIDSelStart) = ; >Upper(Substr(This.Value,1,.nIDSelStart)) >