AnsweredAssumed Answered

my iQueryFilber.SubFields does not work

Question asked by helenchu on Sep 10, 2012
All:
I'm trying to export a feature layer to shapefile with certain fields.  This is what I have.  I don't know what I did wrong but it keeps exporting all fields from the feature layer.  Thanks in advance for your help.

ElseIf UCase(pFLayer.Name) = "myLayerName"

                    Dim pQueryFilter As IQueryFilter
                    pQueryFilter = New QueryFilterClass()
                    pQueryFilter.SubFields = "OBJECTID, CODE, NAME"
                    pFsel = pFLayer
                    pFsel.SelectFeatures(pQueryFilter, esriSelectionResultEnum.esriSelectionResultNew, False)
                    pSelSet = pFsel.SelectionSet
else
                    pFsel = pFLayer
                    If pFsel.SelectionSet.Count = 0 Then  'if nothing is selected, select all
                        pFsel.SelectFeatures(Nothing, esriSelectionResultEnum.esriSelectionResultNew, False)  'here select everything
                    End If
                   pSelSet = pFsel.SelectionSet
end if

Outcomes