This only appears to be an issue with Personal Geodatabases (MS Access back end)... I need to search within an existing selection set to populate an ICursor. My main objective is to test whether my IQueryFilter retrieves more that one record but there is no count property over the ISelectionSet using a QueryFilter just like there is over a feature class (IFeatureCLass:FeatureCount(IQueryFilter). So in order to test whether my QueryFilter retrieves more than one record inside a selection set I am having to use the Search method
pFeatureSelection.SelectionSet.Search(pQueryFilter, True, selCursor) using recycling cursor for speed then advancing to next row and again to next row to find out whether more that one row has been retrieved using my QueryFilter. (This feels awfully inefficient but works when not used over PGDB FC)
This works perfectly when used with file geodatabases and shapefiles (I customize the where clause accordingly based on the workspace type of the feature class) however when I do this over personal geodatabase the ISelectionSet:Search method fails. What is strange that it only fails after it has first succeeded many times prior. The queries I assign to the WhereClause of the query filter are very simple (i.e.
"[MASTER_ID] = '56061-UNPAT-28'")
The error I am getting is "Error HRESULT E_FAIL has been returned from a call to a COM component." Err.number -2147467259
To reiterate, the very same code works fine when used with FGDB feature class and Shapefile, it's only on PGDB (Access) that it fails this way and only after it run for a while.
I ultimately need to obtain a count within a selection set that satisfies a simple query. If there is an alternate or more efficient way of doing this please share...