Sub test() Dim pMxDoc As IMxDocument Set pMxDoc = ThisDocument Dim pFL As IFeatureLayer Set pFL = pMxDoc.FocusMap.Layer(0) Dim pFeatureClass As IFeatureClass Set pFeatureClass = pFL.FeatureClass Dim strFieldName As String strFieldName = "P_NUM" Dim pQueryFilter As IQueryFilter Set pQueryFilter = New QueryFilter pQueryFilter.SubFields = strFieldName pQueryFilter.WhereClause = "[OBJECTID] > 2000" Dim pQueryFilterDefinition As IQueryFilterDefinition Set pQueryFilterDefinition = pQueryFilter pQueryFilterDefinition.PostfixClause = "ORDER BY " & strFieldName Dim pFeatureCursor As IFeatureCursor Set pFeatureCursor = pFeatureClass.Search(pQueryFilter, True) Dim codeix As Long codeix = pFeatureCursor.FindField(strFieldName) Dim pFeature As IFeature Set pFeature = pFeatureCursor.NextFeature While Not pFeature Is Nothing MsgBox pFeature.Value(codeix) Set pFeature = pFeatureCursor.NextFeature Wend End Sub
属性検索で取り出したレコードの順序を変更する方法
2016/9/1 (木)