caseyogden

Table Sort Not Sorting

Discussion created by caseyogden on Feb 22, 2011
This code adds selected records to a ComboBox.  But how to I get it to sort by ascending? 

'Won't work, must infuse this code to the working code below.  

''Set pTable2 = player2.Featureclass
''sFieldName2 = "facil_no"
''Set pTableSort2 = NewTableSort
''With pTableSort2
''.Fields = sFieldName2
''.Ascending (sFieldName2) = True
''Set .Table = pTable2
''End With
''pTableSort2.Sort Nothing


Dim pData2 As IdataStatistics
Set pData2 = New esriGeoDatabase.Datastatistics
pData2.Field = "facil_no"

Dim pSelSet2 As ISelectionSet
Dim pFSelLayer2 As IFeatureSelection
Set pFSelLayer2 = pLayer2
Set pSelSet2 = pFSelLayer2.SelectionSet
pFSelLayer2.SelectionChanged
Set pActiveView = pMxDoc.Activeview
pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing
Dim pFtr2 As IFeature
pSelSet2.Search Nothing, False, pCur2

Set pData2.Cursor = pCur2

Set pRow = pCur2.NextRow

Dim EnumVar2 As IenumVariantSimple, value As Variant, str As String
Set pEnumVar2 = pData2.UniqueValues

value = pEnumVar2.Next
Do Until IsEmpty(value)
Project.Nepa1.Combobox2.AddItem value
value = pEnumVar2.Next
Loop

Project.Nepa1.Combobox2.value = ""

Outcomes