Hi there Lauren,I was a little confused by your useage of the QueryFilterClass() as I am unsure if this goes along with the IMxDocument --- from what I see, it belongs with ArcMobile and or WebADF. Of course, I could be reading that incorrectly. Are you working with ArcMap for this?In any event, I've taken some snippets from similar functionality that I use for some ArcMap customizations and added to your existing code you posted. I pretty much left what you had, added to it and altered the WHERE clause portion (I noticed some minor syntax problems with what you had).Anyway -- let me know if this works!Take Care.
Dim pMXDoc As ESRI.ArcGIS.ArcMapUI.IMxDocument
pMXDoc = My.ArcMap.Document
Dim pMap As ESRI.ArcGIS.Carto.IMap
pMap = pMXDoc.FocusMap
Dim pFeatureLayer As ESRI.ArcGIS.Carto.IFeatureLayer
Dim pActiveView As ESRI.ArcGIS.Carto.IActiveView
pActiveView = pMap
Dim pFeatureSelection As ESRI.ArcGIS.Carto.IFeatureSelection
Dim LayerName As String
LayerName = "Cadastre - Parcels"
For i = 0 To pMap.LayerCount - 1
If UCase(pMap.Layer(i).Name.Trim()) = UCase(LayerName.Trim()) Then
pFeatureLayer = pMap.Layer(i)
Exit For
End If
Next
'Get attributes from the textboxes
Dim AttPlanNumber As String
Dim AttLotNumber As String
Dim SearchStatement As String
AttPlanNumber = txtDPNumber.Text
AttLotNumber = txtLotNumber.Text
pFeatureSelection = pFeatureLayer
'setup a QueryFilter and where clause
'If both Plan and Lot number MUST match, then use this
Dim str As String = "PLANNO = '" & AttPlanNumber & "' AND " & LOTNO = '" & AttLotNumber & "'"
'If either Plan or Lot number can match, then use this
Dim str As String = "PLANNO = '" & AttPlanNumber & "' OR " & LOTNO = '" & AttLotNumber & "'"
Dim pQueryFilter As IQueryFilter
pQueryFilter = New QueryFilter
pQueryFilter.WhereClause = str
pFeatureSelection.SelectFeatures(pQueryFilter, esriSelectionResultEnum.esriSelectionResultNew, False)
' Refresh the selection
pMxDoc.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, Nothing, Nothing)
'Zoom to the selected features
Dim pSelectionSet As ISelectionSet
pSelectionSet = pFeatureSelection.SelectionSet
Dim pEnumGeom As Geometry.IEnumGeometry
Dim pEnumGeomBind As IEnumGeometryBind
pEnumGeom = New EnumFeatureGeometry
pEnumGeomBind = pEnumGeom
pEnumGeomBind.BindGeometrySource(Nothing, pSelectionSet)
Dim pGeomFactory As Geometry.IGeometryFactory
pGeomFactory = New Geometry.GeometryEnvironmentClass
Dim pGeom As IGeometry
pGeom = pGeomFactory.CreateGeometryFromEnumerator(pEnumGeom)
pMxDoc.ActiveView.Extent = pGeom.Envelope
pMxDoc.FocusMap.MapScale = 2500
pMxDoc.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, Nothing, Nothing)
pMxDoc.ActiveView.Refresh()