>>i have a grid in my form where i want to order the recordsource (a cursor from select * drs into cursor csrdrs) when my user click on each column's header.
i want to know first in what oder is the column set, so i should be able to do an order by ascending or descending.>>
Hi Evelyn,
You can do this,
let say, you first issued this statement,
select * drs into cursor csrdrs order by DATE Ascending, be it in load or init event...
lAsc = .T.
Now, let say your first grid column controlsource is bind to csrdrs.date, on you header click event, you can put this code
Select csrdrs
If lAsc
Index on date to data\datedesc Descending
lAsc = .F.
Else
Index on date to data\dateasc Ascending
lAsc = .T.
Endif
Thisform.grid1.refresh
You can do also same with other columns on your grid..
The index on command, you can store the temporary indexes to your temp folder. Its more easier than issuing another select statement against a table