>>Try with
>>
>>...
>>ORDER BY 1
>>
>
>Yep, that does it. I had tried that already today, with no luck...But, when you suggested it, I went back and tried some more things:
>
>You see, the case is tricky because I must eval it since the user may have chosen to sort by another column. There are actually more columns than what I showed in my example code. I just posted a simpler version to make it easy to see the problem.
>
>It's pretty much all eval'd. (See code below.)
>
>Any way, when I tried earlier, I had set the Form property that controls this to '1', which did not work, but I finally realized that I had to enter ='1' into the Property Sheet, then it started working!
>
>Here is the actual code, where you can see all the evals:
>
>
> *-- Pull template structure and then local child records
> Select * From &lcTemplate where 1=2 Into cursor &lcDiskFile;
> Union All;
> Select &lcCopyFlds;
> From &lcChildAlias with (BUFFERING=.T.);
> Where &lcCriteria;
> Order By &lcChildOrderField
>
If this is the case, you need to use your unordered select as derived table, e.g.
select * from (mySelect with union) Derv order by &lcChildOrderField
If it's not broken, fix it until it is.
My Blog