Use macro substitution...
ORDER BY &mOrderBy
or try
ORDER BY (mOrderBy)
>In trying to use a memory variable in the ORDER BY clause of a SELECT statement, I am getting the following error message...
>
>"SQL: Column 'MORDERBY' is not found.
>
>The code I am trying to run is as follows...
>
>DO CASE
> * CASE Order By Cust
> CASE ThisForm.optOrderBy.optOrderByCust.Value = 1
> STORE "Cust, OrdDate, Invoice, Prodct" TO mOrderBy
>
> * CASE Order By Product
> CASE ThisForm.optOrderBy.optOrderByProduct.Value = 1
> STORE "Prodct, OrdDate, Cust, Invoice" TO mOrderBy
>
>ENDCASE
>
>SELECT * ;
> FROM InvHist ;
> INTO ARRAY arrInvHist2 ;
> ORDER BY mOrderBy
>
>
>Would appreciate any help if somebody knows of a way to do accomplish this (or something akin to it). TIA, Chuck.