Automaticly enter address for selected parcel features

Discussion created by cmcleod on Sep 27, 2010
Latest reply on Sep 29, 2010 by cmcleod
I want to use a input box to start entering addresses to parcels.  I want to first select the parcels then click on a command button that will populate the ST_Number field
I got the change part to work so I put it in a seperated function that is called.  I need to pass the value in the OBJECTID field of the selected feature to the change function. I'm fairly new to VBA and am stuck any help is appreciated.

Private Sub UIButtonControl1_Click()
    Dim mAddress As Integer
    Dim pLayer As IFeatureLayer
    Dim pClass As IFeatureClass
    Dim pMap As IMap
    Dim pDoc As IMxDocument
    Dim pFields As IFields
    Dim pField As IField
    Dim pFeat As IFeature
    Dim pRowIdObj As IRowIdentifyObject
    Dim pIdObj As IIdentifyObj
    Dim i As Integer
    Set pDoc = Application.Document
    Set pMap = pDoc.FocusMap
    Set pLayer = pMap.Layer(2)
    Set pClass = pLayer.FeatureClass
    Set pFields = pClass.Fields
    Set pRowIdObj = pIdObj
    Set pFeat = pRowIdObj.Row
    Set pFields = pFeat.Fields
    mAddress = InputBox("Enter First Address")

    Dim i As Integer
    For i = 0 To pFields.FieldCount - 1
        Set pField = pFields.Field(i)
        mChange (pField)
        mAddress = mAddress + 2
    Next i

End Sub
Public Sub mChange(mRec As Integer)

    Dim pDoc As IMxDocument
    Dim pMap As IMap
    Dim pFLayer As IFeatureLayer
    Dim pFeature As IFeature
    Dim mAddress As Integer
    Set pDoc = Application.Document
    Set pMap = pDoc.FocusMap
    Set pFLayer = pMap.Layer(2)
    Set pFeature = pFLayer.FeatureClass.GetFeature(mRec)
     mAddress = InputBox("Enter Address", "Ghana Address")
    If mAddress < 1 Then
        Exit Sub
    End If
    pFeature.Value(pFeature.Fields.FindField("St_Number")) = mAddress

End Sub