PROBLEM

DoZoomToFeatures limits the Records only to those satisfying the criteria

Last Published: April 25, 2020

Description

With ActiveX Connector, you can use DoZoomToFeatures function of Map object to zoom to the features you are interested in. However, this function also limits the Recordset of the active layer to only those records that satisfy the criteria specified in the function.
For example, the code:

Code:

Map.DoZoomToFeatures statelayer,"STATE_NAME","'Oregon','California'"


will make the map zoom to the area that contains Oregon and California. It also results in the recordset: statelayer.Recordset to contain just 2 records, 1 for Oregon and California each.

Cause

The WHERE expression passed to the DoZoomToFeatures function acts as a filter for the given Layer. Hence, only those features which satisfy the expression will be included in the Recordset.

Solution or Workaround

Set the Recordset's filter to nil ("") as shown below if you need to retain all features in the Recordset.

Code:

Map.DoZoomToFeatures statelayer,"STATE_NAME","'Oregon','California'"
statelayer.Recordset.Filter.WhereExpression = ""

Article ID:000005917

Software:
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic