SortAdoDataGrid



'Windows API/Global Declarations for :DataGrid Sort

'**************************************

Dim WithEvents adoPrimaryRS As Recordset
Private Sub grdDataGrid_HeadClick(ByVal ColIndex As Integer)
Dim strColName As String
Static bSortAsc As Boolean
Static strPrevCol As String

strColName = grdDataGrid.Columns(ColIndex).DataField

'La pressione sulla colonna provoca un Not

'di ordinamento Ascendente/Discendente


If strColName = strPrevCol Then
If bSortAsc Then
adoPrimaryRS.Sort = strColName & " DESC"
bSortAsc = False
Else
adoPrimaryRS.Sort = strColName
bSortAsc = True
End If
Else
adoPrimaryRS.Sort = strColName
bSortAsc = True
End If
strPrevCol = strColName
End Sub

'---====[ pAssed by vbTips32 codeBook ]====---


(sortadodatagrid.html)- by Paolo Puglisi - Modifica del 25/3/2019