Share via


QueryShape method

Returns as a Recordset object containing the records located within a shape drawn on the map. Returns an error for data sets with a HowCreated property of geoDataSetDemographic.

Applies to

Objects: DataSet

Syntax

object.QueryShape(Shape)

Parameters

Part

Description

object

Required. An expression that returns a DataSet object.

Shape

Required Shape object. The shape within which to search. The shape cannot have a Type property of geoLine or geoTextBox.

Example

Sub QueryRecordsInShapeAtCenterOfMap()
Dim objApp As New MapPoint.Application
Dim objMap As MapPoint.Map
Dim objDataSet As MapPoint.DataSet
Dim objRecords As MapPoint.Recordset
Dim objshape As MapPoint.Shape

Dim lngCount As Long

'Set up application and objects to use
objApp.Visible = True
objApp.UserControl = True
Set objMap = objApp.ActiveMap
Set objshape = objMap.Shapes.AddShape( _
geoShapeOval, objMap.Location, 2000, 1000)
lngCount = 0

'Let user create a data map
Set objDataSet = _
objApp.ActiveMap.DataSets.ShowImportWizard

'Find records in shape
objshape.Select
Set objRecords = objDataSet.QueryShape(objshape)
objRecords.MoveFirst
Do While Not objRecords.EOF
lngCount = lngCount + 1
objRecords.MoveNext
Loop
MsgBox "Number of records in shape: " & lngCount
End Sub