-1
Private Sub CommandButton1_Click()

' Part 1: Define the feature class.
Dim pMxDoc As IMxDocument
Dim pFeatureLayer As IFeatureLayer
Dim pFeatureClass As IFeatureClass
Dim name1 As Variant
Set pMxDoc = ThisDocument
Set pFeatureLayer = pMxDoc.FocusMap.Layer(0)
Set pFeatureClass = pFeatureLayer.FeatureClass

Dim pCursor As ICursor
Dim pCalculator As ICalculator

' Prepare a cursor with all records.
Set pCursor = pFeatureClass.Update(Nothing, True)

' Define a calculator.
Set pCalculator = New Calculator
Set pCalculator.Cursor = pCursor

' Calculate the field values.
pCalculator.Expression = "OwnerName1"
pCalculator.Field = "OwnerName12"
pCalculator.Calculate
pMxDoc.ActivatedView.Refresh

End Sub

enter image description here

1

If you look at the code sample on the API help page you will see they use a search cursor, you are using an update cursor. Also take note on how the sample sets up the expression property when writing a text value to the field. They are enclosing the text within triple quotes you are not doing this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.