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 5 of 5

Accessing the address information of a waypoint

This is a discussion on Accessing the address information of a waypoint within the MapPoint Desktop Discussion forums, part of the Map Forums category; In the application I am writing, I take a list of addresses from a customer database. I pass that list ...

  1. #1
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    Accessing the address information of a waypoint

    In the application I am writing, I take a list of addresses from a customer database. I pass that list to MapPoint and optimize the route. Then, I need to read the individual addresses out of Mappoint so that I can write the addresses back to a text file in their new optimized order. With me so far?

    So, here's my code that builds the route:
    Code:
        For intStopCounter = 0 To lstStops.ListCount - 1
            oRte.Waypoints.Add oMap.FindAddressResults(stopData(intStopCounter).add1, _
                stopData(intStopCounter).city, , _
                stopData(intStopCounter).state, _
                stopData(intStopCounter).zip)(1)
        Next
    and here's my export code.

    Code:
        intFileNumber = FreeFile
        Open strFileName For Output As intFileNumber
        
        For intStopCounter = 0 To oRte.Waypoints.Count - 1
            strOut = Trim(Str(intStopCounter)) & "|"
            strOut = oRte.Waypoints.Item(intStopCounter).Location.StreetAddress.Street & "|"
            strOut = oRte.Waypoints.Item(intStopCounter).Location.StreetAddress.city & "|"
            strOut = oRte.Waypoints.Item(intStopCounter).Location.StreetAddress.Region & "|"
            strOut = oRte.Waypoints.Item(intStopCounter).Location.StreetAddress.PostalCode & "|"
            strOut = Trim(Str(oRte.Waypoints.Item(intStopCounter).ListPosition))
            Print #intFileNumber, strOut
        Next
        
        Close intFileNumber
    I'm getting an error on the second line of the export, the line that tries to get the StreetAddress.Street value. The error I'm seeing is "The requested member of the collection does not exist. Use a valid name or index number."

    Can someone tell me where I'm going wrong? Thanks in advance. I can't seem to figure out precisely what's wrong.

  2. #2
    DWRoelands is offline Junior Member White Belt
    Join Date
    Sep 2003
    Posts
    2
    Whoops. Forgot to log in before posting. Apologies.

  3. #3
    DWRoelands is offline Junior Member White Belt
    Join Date
    Sep 2003
    Posts
    2
    Man! I keep forgetting important information. This is Map Point 2002.

  4. #4
    rbarthels is offline Member Green Belt
    Join Date
    Nov 2002
    Posts
    52
    Indicies from MP-Collections are starting from 1

  5. #5
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    Re: Accessing the address information of a waypoint

    Quote Originally Posted by Anonymous
    In the application I am writing, I take a list of addresses from a customer database. I pass that list to MapPoint and optimize the route. Then, I need to read the individual addresses out of Mappoint so that I can write the addresses back to a text file in their new optimized order. With me so far?

    So, here's my code that builds the route:
    Code:
        For intStopCounter = 0 To lstStops.ListCount - 1
            oRte.Waypoints.Add oMap.FindAddressResults(stopData(intStopCounter).add1, _
                stopData(intStopCounter).city, , _
                stopData(intStopCounter).state, _
                stopData(intStopCounter).zip)(1)
        Next
    and here's my export code.

    Code:
        intFileNumber = FreeFile
        Open strFileName For Output As intFileNumber
        
        For intStopCounter = 0 To oRte.Waypoints.Count - 1
            strOut = Trim(Str(intStopCounter)) & "|"
            strOut = oRte.Waypoints.Item(intStopCounter).Location.StreetAddress.Street & "|"
            strOut = oRte.Waypoints.Item(intStopCounter).Location.StreetAddress.city & "|"
            strOut = oRte.Waypoints.Item(intStopCounter).Location.StreetAddress.Region & "|"
            strOut = oRte.Waypoints.Item&#40;intStopCounter&#41;.<B style="color&#58;black;background-color&#58;#ffff66">Location.StreetAddress.PostalCode[/B] & "|"
            strOut = Trim&#40;Str&#40;oRte.Waypoints.Item&#40;intStopCounter&#41;.ListPosition&#41;&#41;
            Print #intFileNumber, strOut
        Next
        
        Close intFileNumber
    I'm getting an error on the second line of the export, the line that tries to get the StreetAddress.Street value. The error I'm seeing is "The requested member of the collection does not exist. Use a valid name or index number."

    Can someone tell me where I'm going wrong? Thanks in advance. I can't seem to figure out precisely what's wrong.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Saving "Place or Address" Information
    By blksheepram in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 07-27-2005, 01:18 PM
  2. Accessing Map Point
    By amitsh in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 03-02-2004, 08:59 AM
  3. address from waypoint
    By starbuck in forum MapPoint Desktop Discussion
    Replies: 7
    Last Post: 11-18-2003, 09:04 AM
  4. Getting address information of location object in delphi?
    By Sheridan in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-07-2003, 09:37 AM
  5. How do I, or can I update address information in M....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 07-12-2002, 12:41 PM

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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96