code problem

mmartin
04-09-2007, 05:02 PM
Hello people,

I'm trying to execute the following code but get an exception on the map object (objmap.location) in the querycircle function. Any ideas...thanks

Public Sub getshape()
Dim objMap As MapPoint.Map
Dim objDataSet As MapPoint.DataSet
Dim objRecords As MapPoint.Recordset
Dim location As MapPoint.FindResults
Dim objfield As MapPoint.Field
Dim lngcount As Integer
AxMappointControl1.NewMap(MapPoint.GeoMapRegion.ge oMapNorthAmerica)
objMap = AxMappointControl1.ActiveMap
objDataSet = AxMappointControl1.ActiveMap.DataSets.GetDemograph ics(MapPoint.GeoCountry.geoCountryUnitedStates)
Dim datafieldkey As Object = "Population (2002)"
Stop
location = objMap.FindResults("reston, va")
objRecords = objDataSet.QueryCircle(objMap.Location, 1000)
objRecords.MoveFirst()
Do While Not objRecords.EOF
lngcount = lngcount + 1
objRecords.MoveNext()
Loop
MsgBox("Number of records in circle: " & lngcount)
End Su:roll:

Winwaed
04-10-2007, 06:55 AM
Do you mean "objMap.Location"?

Or do you mean use your "location" variable? Note that the find methods return a FindResults object. This reports the results quality an a collection of results.
You might need something like "location.item(1)" instead, to choose the first result.


Richard

 
Web mp2kmag.com
mapforums.com