<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic populate a combo box after a select by attributes has been performed: VBA in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/populate-a-combo-box-after-a-select-by-attributes/m-p/464211#M12585</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is my code so far that selects parcels by owners last name:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Private Sub CommandButton1_Click()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pDoc As IMxDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pMap As IMap&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pFeatureLayer As IFeatureLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pActiveView As IActiveView&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pFeatureSelection As IFeatureSelection&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pQueryFilter As IQueryFilter&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'Layer name to find&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim sLayerName As String&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sLayerName = "Parcels" 'CHANGE THE LAYERNAME TO MATCH LAYER NAME OF INTEREST&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pDoc = ThisDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pMap = pDoc.FocusMap&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pActiveView = pMap&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For i = 0 To pMap.LayerCount - 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If UCase(pMap.Layer(i).Name) = UCase(sLayerName) Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pFeatureLayer = pMap.Layer(i)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Exit For&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;' Input Box to prompt user for attribute value&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim NewLastName As String&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim SrchStr As String&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;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&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pFeatureSelection = pFeatureLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'NOTE: Parcels must be added to the ArcMap document and the layer cannot be renamed for this tool to work&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'Create the query filter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pQueryFilter = New QueryFilter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SrchStr = "NewLastName = '" + NewLastName + "'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pQueryFilter.WhereClause = SrchStr&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'Invalidate only the selection cache&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Flag the original selection&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Perform the selection&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pFeatureSelection.SelectFeatures pQueryFilter, esriSelectionResultNew, False&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Flag the new selection&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Use the Built in Zoom Command to Zoom to the Selected Features&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pItem As esriFramework.ICommandItem&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;With Normal.ThisDocument.CommandBars&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pItem = .Find(ArcID.Query_ZoomToSelected)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End With&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pItem.Execute&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Set map scale to 1:20,000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pMxDoc As IMxDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pAV As IActiveView&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pMxDoc = ThisDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pMap = pMxDoc.FocusMap&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pAV = pMxDoc.ActiveView&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;pMap.MapScale = 20000 'units of map layout frame&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pAV.Refresh&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;End Sub&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Mar 2011 14:39:37 GMT</pubDate>
    <dc:creator>JonathanMitchell</dc:creator>
    <dc:date>2011-03-15T14:39:37Z</dc:date>
    <item>
      <title>populate a combo box after a select by attributes has been performed: VBA</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/populate-a-combo-box-after-a-select-by-attributes/m-p/464211#M12585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is my code so far that selects parcels by owners last name:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Private Sub CommandButton1_Click()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pDoc As IMxDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pMap As IMap&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pFeatureLayer As IFeatureLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pActiveView As IActiveView&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pFeatureSelection As IFeatureSelection&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pQueryFilter As IQueryFilter&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'Layer name to find&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim sLayerName As String&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sLayerName = "Parcels" 'CHANGE THE LAYERNAME TO MATCH LAYER NAME OF INTEREST&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pDoc = ThisDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pMap = pDoc.FocusMap&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pActiveView = pMap&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For i = 0 To pMap.LayerCount - 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If UCase(pMap.Layer(i).Name) = UCase(sLayerName) Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pFeatureLayer = pMap.Layer(i)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Exit For&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;' Input Box to prompt user for attribute value&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim NewLastName As String&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim SrchStr As String&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;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&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pFeatureSelection = pFeatureLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'NOTE: Parcels must be added to the ArcMap document and the layer cannot be renamed for this tool to work&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'Create the query filter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pQueryFilter = New QueryFilter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SrchStr = "NewLastName = '" + NewLastName + "'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pQueryFilter.WhereClause = SrchStr&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'Invalidate only the selection cache&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Flag the original selection&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Perform the selection&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pFeatureSelection.SelectFeatures pQueryFilter, esriSelectionResultNew, False&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Flag the new selection&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Use the Built in Zoom Command to Zoom to the Selected Features&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pItem As esriFramework.ICommandItem&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;With Normal.ThisDocument.CommandBars&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pItem = .Find(ArcID.Query_ZoomToSelected)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End With&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pItem.Execute&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;'Set map scale to 1:20,000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pMxDoc As IMxDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pAV As IActiveView&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pMxDoc = ThisDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pMap = pMxDoc.FocusMap&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pAV = pMxDoc.ActiveView&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;pMap.MapScale = 20000 'units of map layout frame&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pAV.Refresh&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;End Sub&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2011 14:39:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/populate-a-combo-box-after-a-select-by-attributes/m-p/464211#M12585</guid>
      <dc:creator>JonathanMitchell</dc:creator>
      <dc:date>2011-03-15T14:39:37Z</dc:date>
    </item>
  </channel>
</rss>

