Select to view content in your preferred language

VBA ArcGIS 9.2 Desktop QueryFilter not returning more than 100 selections

884
7
06-21-2012 12:50 PM
JohnBarnes
Emerging Contributor
I'm running a query that selects sewer lines form a user selected point to the sewer treatment plant.

It works perfectly unless the sewer line from selection to treatment plant has more than 100 segments.

In a nutshell QueryFilter won't select the next line after it reaches 100 selected segments.

Any ideas?

'Set the sanitary layer variable
        Set pFLayer = pMap.Layer(indVal)
            pFLayer.Selectable = True
        Set myVal = pMap.Layer(indVal)

        'Setup the query filter
        Set pQFilter = New QueryFilter
            pQFilter.WhereClause = "LINE_ID = '" & idVal & "' And LINE_SECTION >= " & secVal & " Order By LINE_SECTION"
           
           
        'Get the selection for the layer
        Set pSelection = myVal
            'pSelection.Clear
           
        'Set the selection per the QueryFilter
            pView.PartialRefresh esriViewGeoSelection, Nothing, Nothing
            pSelection.SelectFeatures pQFilter, esriSelectionResultNew, False
            pView.PartialRefresh esriViewGeoSelection, Nothing, Nothing
      
If myFeat.Value(myFeat.Fields.FindField("LINE_SECTION")) = 0 Then Exit Sub

    myCounter = 0
   
Do Until myCounter = 15
   
        'Get the selection set in preparation to loop through the set
        Set pSelectionSet = pSelection.SelectionSet
            pSelectionSet.Search Nothing, False, pFeatureCursor
        Set pFeature = pFeatureCursor.NextFeature
       
        i = 0
       
        'Loop through the set and collect the ids aaString is the final id, pStmains is the array with all the id's
        Do While Not pFeature Is Nothing
           
            If IsNull(pFeature.Value(pFeature.Fields.FindField("SUB"))) = False Then
                Sub1 = pFeature.Value(pFeature.Fields.FindField("SUB"))
                SubSec = pFeature.Value(pFeature.Fields.FindField("SUB_SEC"))
            End If
           
            aaString = pFeature.Value(pFeature.Fields.FindField("Upstreamno"))
            abString = pFeature.Value(pFeature.Fields.FindField("Downstream"))
            lCounter = pFeature.Value(pFeature.Fields.FindField("Length"))

               
                pStmains(i) = aaString & "  to  " & abString & "         ~ " & lCounter
                stCount = stCount + 1
            i = i + 1
            Set pFeature = pFeatureCursor.NextFeature
           
        Loop
       
        'Setup the query filter
        'Set pQFilter = New QueryFilter
            'pQFilter.WhereClause = "LINE_TURN = '" & aaString & "'"
            pQFilter.WhereClause = "LINE_ID = '" & Sub1 & "' And LINE_SECTION >= " & SubSec & " Order By LINE_SECTION"
           
        'Get the selection for the layer
        'Set pSelection = myVal
            'pSelection.Clear
           
        'Set the selection per the QueryFilter
            pView.PartialRefresh esriViewGeoSelection, Nothing, Nothing
            pSelection.SelectFeatures pQFilter, esriSelectionResultAdd, False
            pView.PartialRefresh esriViewGeoSelection, Nothing, Nothing

myCounter = myCounter + 1

Loop
0 Kudos
7 Replies
FengZhang2
Deactivated User
You can reset the 'MaxRecords' of the QueryFilter object:

...
Set pQFilter = New QueryFilter
pQFilter.MaxRecords = 10000
...
0 Kudos
JohnBarnes
Emerging Contributor
Thanks for the reply Feng Zhang, but at least in ArcGIS 9.2 MaxRecords is not a property of the QueryFilter.

jb
0 Kudos
FengZhang2
Deactivated User
Hi John,

Are you using ArcMap 9.2 and the the layer is from layers created in ArcSDE and NOT registered with geodatabases? SQL Server or Oracle?

If it is, please try to install SP2 and try again.

Thanks,

Feng
0 Kudos
FengZhang2
Deactivated User
If possible, I would suggest install ArcGIS 9.2 SP6 just in case it is caused by other similar issue.

ArcSDE 9.2 Service Pack 6 addressed issues contains a number of new fixes as well as all the previous fixes released in Service Packs 1, 2, 3, 4 and 5.
http://downloads2.esri.com/support/downloads/other_/ArcSDE-92sp6_issues.htm
0 Kudos
JohnBarnes
Emerging Contributor
The layer is in a personal geodatabase.

jb
0 Kudos
JohnBarnes
Emerging Contributor
We do not use ArcSDE.

jb
0 Kudos
FengZhang2
Deactivated User
Would you like to share your data and VBA code with me so that I can have a try?

We do not use ArcSDE.

jb
0 Kudos