MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Getting Records within Shapes

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 ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 02-20-2007
Junior Member
White Belt
 
Join Date: May 2006
Posts: 8
Getting Records within Shapes

I've been putting together code snippets that seem to completely solve my problem of determining which of 56,000 records in Excel are within approximately 10 shapes. I think I have everything working except that I'm getting the following error:

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 02-21-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,123
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
records, shapes


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/getting-records-within-shapes-5692.html

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -5. The time now is 07:10 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55