Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 2 of 2

Getting Records within Shapes

This is a discussion on Getting Records within Shapes within the MapPoint Desktop 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 ...

  1. #1
    MagiCat is offline 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

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Unmatched Records pop-up: Sort potential records
    By jempie in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 10-12-2006, 07:07 AM
  2. Not all records import - please help!
    By bombria in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 03-28-2006, 02:03 PM
  3. How do you add records to a dataset
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 05-03-2005, 04:09 PM
  4. Unmatched records
    By fletch in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 03-09-2005, 10:24 AM
  5. How do you add records to an existing dataset?
    By stephenmillington in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 09-07-2004, 05:24 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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 56 57 58 59 60 61 62 63 64 65 66