Ok here is next problem that perhaps someone can help with. I have a text box that is being populated based on the selection from the combobox. The field I have connected to the textbox is a state code field (i.e. Colorado = CO).
However, when I select Colorado from the combo drop down the text box populates with a different records code. I figured out that this based on the FID of the record and there is some issue with the ListIndex but I don't know how to correct this problem. Here is the combobox code:
Private Sub ComboBox1_Change()
Dim pMxDoc As IMxDocument
Dim pMap As IMap
Dim pActiveView As IActiveView
Dim pFeatureLayer As IFeatureLayer
Dim pFeatureSelection As IFeatureSelection
Dim pQueryFilter As IQueryFilter
Dim pFeature As IFeature
Set pMxDoc = Application.Document
Set pMap = pMxDoc.FocusMap
Set pActiveView = pMap
'For simplicity sake let's use the first layer in the map
If Not TypeOf pMap.Layer(0) Is IFeatureLayer Then Exit Sub
Set pFeatureLayer = pMap.Layer(0)
Set pFeatureSelection = pFeatureLayer 'QI
Set pFeature = pFeatureLayer.FeatureClass.GetFeature(ComboBox1.ListIndex)
'Create the query filter
Set pQueryFilter = New QueryFilter
pQueryFilter.WhereClause = "Name = '" & ComboBox1.Text & "'"
'Invalidate only the selection cache
'Flag the original selection
pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing
'Perform the selection
pFeatureSelection.SelectFeatures pQueryFilter, esriSelectionResultNew, False
'Flag the new selection
pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing
TextBox1.Text = pFeature.Value(2)
End Sub