Hi,
I have an MSFlexgrid grid displayed initially sorted by student ID. In the display, I have a sort command button for LastName sorting. The problem is i can't refresh the display after clicking the sort button.
Thanking you in advance.
Here's my code:
VB Code:
----------------------------------------------------------- Private Sub cmdSort_Click() varSortBy = "LastName" ' varSortBy is global var Call Form_Load End Sub ----------------------------------------------------------- Private Sub Form_Load() If varSortBy = "" Then 'Initial Form Load varSortBy = "s_id" MSFlexGrid2.FormatString = "Test" Data2.DatabaseName = App.Path & "\Student.mdb" Data2.RecordSource = "Select * FROM Projects ORDER BY " & varSortBy Else 'Called from sort button varSortBy = varSortBy MSFlexGrid2.FormatString = "Test" Data2.DatabaseName = App.Path & "\Student.mdb" Data2.RecordSource = "select * FROM Projects ORDER BY " & varSortBy MSFlexGrid2.Refresh End If End Sub




Reply With Quote