WVUForester01

Help with SubFields...

Discussion created by WVUForester01 on Apr 16, 2010
The following code will work on a shapefile but not on a GeoDatabase...Any suggestions are appreciated.  This is VB 6 but I have the same issue with VB.NET  Thanks!

Dim pMap As IMap
Set pMap = pFrmMxDoc.FocusMap
Dim pSLayer As IFeatureLayer
Dim pTable As ITable
Dim pRow As IRow
Dim pCursor As ICursor
Dim pQF As IQueryFilter
set pSLayer=pMap.layer(0)
Set pTable = pSLayer.FeatureClass
Set pQF = New QueryFilter

pQF.WhereClause = "STREET_ID= " & LstCenterLinesID.List(LstCenterLines.ListIndex) & ""
pQF.SubFields = "STREET_ID,NEWADDRESS"

Dim pTableSort As ITableSort
Set pTableSort = New TableSort
With pTableSort
.Fields = "NEWADDRESS"
.Ascending("NEWADDRESS") = True
Set .QueryFilter = pQF
Set .Table = pTable
End With
pTableSort.Sort Nothing
Set pCursor = pTableSort.Rows
Set pRow = pCursor.NextRow
Do Until pRow Is Nothing
LstAddresses.AddItem (pRow.value(pRow.Fields.FindField("NEWADDRESS")))
Set pRow = pCursor.NextRow
Loop

Outcomes