>Hi,
>
>I have a grid on a form and set the column header to BOLD, the caption is Customer Code, Customer Name.
>I have some code in click event on the column header, but after run the select statement, it reset all the setting of the grid,
>the header change to the cursor field name, not bold, the header click event reset to none.
>
>why ?
>
>the code as follow:-
>
>
>SELECT cusmas->cusno,cusmas->cusname FROM cusmas INTO CURSOR cusmas_srh ORDER BY cusmas->cusno
>SELECT cusmas_srh
>GO top
>thisform.grdClient.RecordSource="cusmas_srh"
>thisform.grdClient.Refresh()
>thisform.grdClient.COLUMN1.SetFocus()
>
>
>Please advise.
>Thank
>Derek
You're running into known 'grid restoration' problem. There are two common ways to avoid it.
1. Safe Select approach - google on 'Andy Kramek Safe Select'
2. Reset grid's RecordSource to empty string before running SQL statement.
If it's not broken, fix it until it is.
My Blog