Dim pMxDoc As IMxDocument Set pMxDoc = ThisDocument Dim pFeatureLayer As IFeatureLayer Set pFeatureLayer = pMxDoc.FocusMap.Layer(0) MsgBox pFeatureLayer.Name 'displays correct layer name Dim pFeatureSelection As IFeatureSelection Set pFeatureSelection = pFeatureLayer Dim pSelectionSet As ISelectionSet2 Set pSelectionSet = pFeatureSelection.SelectionSet MsgBox pSelectionSet.Count 'displays correct count Dim pFeatureCursor As IFeatureCursor pSelectionSet.Update Nothing, True, pFeatureCursor 'this line produces an automation error Dim pFeature As IFeature Set pFeature = pFeatureCursor.NextFeature MsgBox pFeature.Value(2) End Sub
The exact error message is:
Run-time error '-2147467259 (800040005)':
Automation error Unspecified error
Any advice on what I'm doing wrong? I'm working in ArcGIS 9.3.1.
Thank you for the reply. Unfortunately, I still get the error after making the substitution you suggested. Also, no features in the map participate in a topology or a geometric network.
What is the format of your data? I tried your code on some random shapefile I have and it worked. Your data isn't some sort of compressed (hence read only) dataset?