My data bound grid control has data control as the data source.
I have assigned a table name in the record source of the data control.
I have following code in the form activate event
Data1.Recordset.Sort = "Name"
but when the form is loaded, grid doesn't show any changes and the Name column is still in unsorted form.
Now i again entered following codes in the form activate event
Data1.RecordSource = "SELECT * FROM TableName ORDER BY Name"
However it solved my problem a new problem arised.
When I add new record to that table then the data bound grid control doesn't update the grid as it was updating while i selected TableName as the recordsource of data control instead of SQL statement.
The grid can be updated by Data1.Refresh method but this change the bookmark of the recordset. The current cell should be at the same row when it was before adding the data.
Please solve my problem so that the grid contain sorted data and the current row of the grid should not change while new data is added.