populate a combo box after a select by attributes has been performed: VBA

Discussion created by jpmitchell on Mar 15, 2011
Right now I have a code in VBA that will select land parcels by performing a select by attributes using the land owners last name. I want to add one more step to it. When I run the select by attributes I may get 20 parcels with the same last name. So I am wanting to figure out how to add the land owners first name once the select by attributes has been performed so that I can zoom to the desired land owners parcel. This is a command button in a user form.

This is my code so far that selects parcels by owners last name:

Private Sub CommandButton1_Click()

Dim pDoc As IMxDocument
Dim pMap As IMap
Dim pFeatureLayer As IFeatureLayer
Dim pActiveView As IActiveView
Dim pFeatureSelection As IFeatureSelection
Dim pQueryFilter As IQueryFilter

'Layer name to find
Dim sLayerName As String

Set pDoc = ThisDocument
Set pMap = pDoc.FocusMap
Set pActiveView = pMap

For i = 0 To pMap.LayerCount - 1
If UCase(pMap.Layer(i).Name) = UCase(sLayerName) Then
Set pFeatureLayer = pMap.Layer(i)
Exit For
End If

' Input Box to prompt user for attribute value
Dim NewLastName As String
Dim SrchStr As String
NewLastName = InputBox("Enter Last Name (e.g., MITCHELL) Note: This tool will select a parcel, zoom to the selection, and set the map scale to 1:20,000. Please add the GIParcels feature class to your ArcMap project first.", "Select Study Parcel By NewLastName", 0) 'CHANGE PID TO MATCH FIELD NAME OF INTEREST
Set pFeatureSelection = pFeatureLayer
'NOTE: Parcels must be added to the ArcMap document and the layer cannot be renamed for this tool to work

'Create the query filter
Set pQueryFilter = New QueryFilter
SrchStr = "NewLastName = '" + NewLastName + "'"
pQueryFilter.WhereClause = SrchStr

'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
'Use the Built in Zoom Command to Zoom to the Selected Features
Dim pItem As esriFramework.ICommandItem
With Normal.ThisDocument.CommandBars
Set pItem = .Find(ArcID.Query_ZoomToSelected)
End With
'Set map scale to 1:20,000
Dim pMxDoc As IMxDocument
Dim pAV As IActiveView

Set pMxDoc = ThisDocument
Set pMap = pMxDoc.FocusMap
Set pAV = pMxDoc.ActiveView

pMap.MapScale = 20000 'units of map layout frame

End Sub