Private Function SelectByApn_ToolTip() As String SelectByApn_ToolTip = "Select By APN" End Function Private Function SelectByApn_Enabled() As Boolean SelectByApn_Enabled = LayerSelected_1only End Function Private Sub SelectByApn_Click() On Error GoTo EH Dim pMxDoc As IMxDocument Set pMxDoc = ThisDocument Dim pActiveView As IActiveView Set pActiveView = pMxDoc.FocusMap 'Verify the selected layer is a feature layer If Not TypeOf pMxDoc.SelectedLayer Is IFeatureLayer Then Exit Sub 'Get the selected layer Dim pFeatLayer As IFeatureLayer Set pFeatLayer = pMxDoc.SelectedLayer Dim pFeatSel As IFeatureSelection Set pFeatSel = pFeatLayer 'QI 'Create the query filter Dim pQueryFilter As IQueryFilter Set pQueryFilter = New QueryFilter Dim sInput As String sInput = InputBox("Enter APN or partial APN", "QUERY APN") pQueryFilter.WhereClause = "APN LIKE '" & sInput & "%'" 'Perform the selection and redraw pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing pFeatSel.SelectFeatures pQueryFilter, esriSelectionResultNew, False pActiveView.PartialRefresh esriViewGeoSelection, Nothing, Nothing 'Zoom to selected features using built-in command Dim pCmdItem As ICommandItem Set pCmdItem = ThisDocument.CommandBars.Find(ArcID.Query_ZoomToSelected) pCmdItem.Execute Set pQueryFilter = Nothing Exit Sub EH: MsgBox "ERROR #" & Err.Number & vbCrLf & Err.Description & vbCrLf & "SelectByApn_Click" End Sub Private Function LayerSelected_1only() As Boolean Dim pMxDoc As IMxDocument Set pMxDoc = ThisDocument Dim pTOCView As IContentsView Set pTOCView = pMxDoc.CurrentContentsView LayerSelected_1only = False If (TypeOf pTOCView.SelectedItem Is ILayer) Then LayerSelected_1only = True End If End Function