Community of VE/MapPoint Users and Developers
This is a discussion on Getting Records within Shapes within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I've been putting together code snippets that seem to completely solve my problem of determining which of 56,000 records in ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Getting Records within Shapes Error 438: Object doesn't support this property or method in the line: objRecords.Pushpin.MoveTo (objDataInShapes) If I get rid of the line, it works completely and outputs the right number of shapes but I need to move the shapes to the other DataSet. Can anyone tell me what I'm doing wrong? Here's the full code: Code: Sub QueryRecordsInShapes()
Dim objApp As New MapPoint.Application
Dim objMap As MapPoint.Map
Dim objDataSet As MapPoint.DataSet
Dim objDataInShapes 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.OpenMap("c:\toters\toters.ptm")
lngCount = 0
'Let user create a data map
Set objDataSet = objApp.ActiveMap.DataSets.ShowImportWizard
'Create New Dataset
Set objDataInShapes = objApp.ActiveMap.DataSets.AddPushpinSet("InShapes")
'iterate through all shapes
For Each objshape In objMap.Shapes
'Find records in shape
objshape.Select
Set objRecords = objDataSet.QueryShape(objshape)
objRecords.MoveFirst
Do While Not objRecords.EOF
lngCount = lngCount + 1
'Getting Error
objRecords.Pushpin.MoveTo (objDataInShapes)
objRecords.MoveNext
Loop
Next
MsgBox "Number of records in shapes: " & lngCount
End Sub
|
| |||
| Re: Getting Records within Shapes
Hi, If you move objects to something else in a loop then it dissapear from the original loop and you disturp the counter who does not automatically decrement the count value.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
![]() |
| Tags |
| records, shapes |
| ||||
| Posted By | For | Type | Date | |
| The Magazine for MapPoint - MP2K Magazine | This thread | Refback | 02-21-2007 03:58 AM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unmatched Records pop-up: Sort potential records | jempie | MapPoint 2006/2009 Discussion | 0 | 10-12-2006 07:07 AM |
| Not all records import - please help! | bombria | MapPoint 2006/2009 Discussion | 2 | 03-28-2006 02:03 PM |
| How do you add records to a dataset | Anonymous | MapPoint 2006/2009 Discussion | 1 | 05-03-2005 04:09 PM |
| Unmatched records | fletch | MapPoint 2006/2009 Discussion | 0 | 03-09-2005 10:24 AM |
| How do you add records to an existing dataset? | stephenmillington | MapPoint 2006/2009 Discussion | 0 | 09-07-2004 05:24 AM |