IFeatureClass.Select method is not working

Discussion created by dan.nguyen27 on May 20, 2010
Latest reply on May 21, 2010 by dan.nguyen27
Does anyone know why the following code is not working?
the count shows 1 but it does show on ArcMap.  It was working yesterday and I am not sure why it doesn't work anymore.  This is similiar problem with 'Starting Editor' I had.  It was working at the beginning and then it doesn't work anymore.

Thanks for any help


Sub SelectTesting()
    Dim pFeatcls As IFeatureClass
    Dim pFeatLayer As IFeatureLayer
    Dim pDoc As IMxDocument
    Dim pMap As IMap
    Set pDoc = ThisDocument
    Set pMap = pDoc.FocusMap
    'Set pMap = pDoc.Maps.Item(0)
    Set pFeatLayer = pMap.Layer(0)
    Set pFeatcls = pFeatLayer.FeatureClass
    Dim pScratchWorkspace As IWorkspace
    Dim pScratchWorkspaceFactory As IScratchWorkspaceFactory
    Set pScratchWorkspaceFactory = New ScratchWorkspaceFactory
    Set pScratchWorkspace = pScratchWorkspaceFactory.DefaultScratchWorkspace
    Dim pQFilt As IQueryFilter
    Set pQFilt = New QueryFilter
    pQFilt.WhereClause = "OBJECTID = 657704"
    Dim pSelectionSet As ISelectionSet
    Set pSelectionSet = pFeatcls.Select(pQFilt, esriSelectionTypeIDSet, esriSelectionOptionNormal, pScratchWorkspace)
    MsgBox pSelectionSet.Count
End Sub