Dim value as String
pFeature = pFeatureCursor.NextFeature
Do Until pFeature Is Nothing
value = pFeature.Value(pFeature.Fields.FindField("TheFieldName"))
pFeature = pFeatureCursor.NextFeature
Loop
I am able to get the value of a field name "FID" in a message box. I am trying to put this value into a word doc Bookmark.
How can I do this. Any help.
Code I used to get the field value of "FID":
M = pFeat.Value(pFeat.Fields.FindField("FID")) pFeat = pEnumFeat.Next MsgBox(M) /// I need this value shown in message box pulled into a word doc bookmark.
If you just want to loop through all the values you could do something like this
feature = get feature with the method of your choice i = 0 for i to feature.fields.count -1 theValue = feature.value(i) theFieldName = feature.fields.field(i)
Of course you have to be careful the way you handle the field values, you will be getting objectids, shapes, integers, strings and probably dbnulls.
' loop through each field and add the field name to a list For ii = 0 To fields.FieldCount - 1 Field = fields.Field(ii) fieldname = Field.Name fieldvalue = Field.VarType ' fieldvalue = pFeat.Value(pFeat.Fields.Field) '' trying to get the field value 'value = Field.DefaultValue '' trying to get the field value
' loop through each field and add the field name to a list For ii = 0 To fields.FieldCount - 1 Field = fields.Field(ii) fieldname = Field.Name fieldvalue = pFeat.Value(ii)