I am working in VBA with ArcGIS Desktop 9.3.1, SDE and Oracle.
My feature class is versioned and has a composite relationship with a standalone table (also versioned).
While in an edit session:
My code listens for edits to the feature class.
When an edit is made, the code updates the Rev_Date field in the edited feature class with the current date.
User can visually verify the updated Rev_Date in the Attribute Window.
User can continue to make edits on other features and they all reflect the updated Rev_Date.
However, after user selects "Save Edits" from the Editor menu, the Rev_Date for all edited features revert to original values!
Is this problem due to a compatilitity issue between the interfaces I am using (ifeaturecursor, ifeature.value) and fields residing in a versioned (SDE) feature class?
My code for the update is below.
Thanks, Jill (USFS, Region 6)
Public Sub UpdateAnnoLayer(k, l As Long) On Error GoTo EH
[INDENT] 'Initialize variables
Dim m_pMxDoc As IMxDocument Set m_pMxDoc = ThisDocument 'Application.Document Dim m_pMap As IMap Set m_pMap = m_pMxDoc.Maps.Item(0) Dim m_pCurrentLayer As ILayer Dim pFeatureLayer As IFeatureLayer Set pFeatureLayer = m_pMap.Layer(gi_LayerIndex) 'sets reference layer to current layer Dim pFeatureClass As IFeatureClass Set pFeatureClass = pFeatureLayer.FeatureClass Dim pQueryFilter As IQueryFilter Set pQueryFilter = New QueryFilter Dim pFields As IFields Set pFields = pFeatureClass.Fields Dim pFeatureCursor As IFeatureCursor Dim mi_FieldIndex1 As Integer mi_FieldIndex1 = pFields.FindField("REV_DATE") Dim pFeature As IFeature Dim i As Long
'Change the REV_DATE and DATA_SOURCE values in annotation feature to _ match values entered in form For i = k To l 'UBound(ga_FieldValues) [INDENT] pQueryFilter.WhereClause = "OBJECTID = " & ga_CollectedEdits(i)(6) Set pFeatureCursor = pFeatureClass.Update(pQueryFilter, False) Set pFeature = pFeatureCursor.NextFeature If pFeature Is Nothing Then [INDENT] MsgBox "Anno Layer not updated. Unable to locate query " _ & pQueryFilter.WhereClause & " on layer index " & gi_LayerIndex Exit Sub [/INDENT] Else [INDENT] pFeature.Value(mi_FieldIndex1) = Date Set pFeature = pFeatureCursor.NextFeature[/INDENT] End If[/INDENT] Next i 'Set marker to indicate current edit is complete gb_LoopCompleted = True[/INDENT] Exit Sub