Sorting Data Within a Datagrid

Sorting Data Within a Datagrid

Data is sorted by using the “ORDER BY” clause in a SQL statementand then assigning the SQL statement to the RecordSource property of thedata control that the DataGrid is bound to. This code displays the Authortable in the DataGrid and sorts it by the LastName field:

 Sub Form1_Load() Data1.RecordSource = "Select * from Authors _ Order By LastName" Data1.Refresh End Sub 


Share the Post: