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
Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Automating Access and Mappoint

This is a discussion on Automating Access and Mappoint within the MapPoint Desktop Discussion forums, part of the Map Forums category; I have a client who I built an Access database for. The systems manages a days worth of client appointments, ...

  1. #1
    rbuonocore is offline Junior Member White Belt
    Join Date
    Sep 2006
    Posts
    1

    Automating Access and Mappoint

    I have a client who I built an Access database for. The systems manages a days worth of client appointments, approx. 10 per day. I'm trying to automate Access to open Mappoint, send the addresses of the 10 appointments, and then have Mappoint create the best route for the day.

    Does anyone have experience with this or sample code I can check out. Although I'm good with Access, I've never used Mappoint before.

    Any help would be appreciated.

    Robby

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

    If you do a search on this forum to VBA, Excel, Access, .. it should give you already some articles to start. You have 2 approach, taht is using the object model where you use Mappoint for calculations eventually invisible, The other is the ocx control that you can drop on a form.

    But dont hesitate to ask here when you get into some problem

  3. #3
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4
    There's a few articles that come to mind on MP2Kmag that can help you get started --

    Tracking P.F. Chang’s in the Midwest - MapPoint Articles - MP2K Magazine

    Home Locator Sample Application - MapPoint Articles - MP2K Magazine

    Using MapPoint from Word, Access and Excel - MapPoint Articles - MP2K Magazine

    You could probably use any one of them to get started, but you will probably like the examples of all three.

    Eric

  4. #4
    plevine1 is offline Junior Member Yellow Belt
    Join Date
    Jun 2006
    Posts
    16

    Re: Automating Access and Mappoint

    I used the HomeLocator sample and learned much from it. The problem is that it just displays the multiple locations on the map but doesnt plan the route. I can do this manually but would rather have it done for me.
    How can I extend the sample code to automatically include the route.
    Thanks

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

    Re: Automating Access and Mappoint

    Hi,

    Code:
                // set start point
                Location loc = map.GetLocation(Lat, Lon, Alt);
                wp = route.Waypoints.Add(loc, "");
                wp.SegmentPreferences = GeoSegmentPreferences.geoSegmentPreferred;
    
                // set waypoints
                loc = map.GetLocation(Lat, Lon, Alt);
                wp = route.Waypoints.Add(loc, "");
                wp.SegmentPreferences = GeoSegmentPreferences.geoSegmentPreferred;
    
                // set end point
                loc = map.GetLocation(Lat, Lon, Alt);
                wp = route.Waypoints.Add(loc, "");
                wp.SegmentPreferences = GeoSegmentPreferences.geoSegmentPreferred;
    
                // set preferred roads
                route.DriverProfile.set_PreferredRoads(GeoRoadType.geoRoadArterial, 0.1);
                route.DriverProfile.set_PreferredRoads(GeoRoadType.geoRoadFerry, 0.1);
                route.DriverProfile.set_PreferredRoads(GeoRoadType.geoRoadInterstate, 0.9);
                route.DriverProfile.set_PreferredRoads(GeoRoadType.geoRoadOtherHighway, 0.6);
                route.DriverProfile.set_PreferredRoads(GeoRoadType.geoRoadToll, 0.2);
    
                // set preferred speed
                route.DriverProfile.set_Speed(GeoRoadType.geoRoadArterial, 50);
                route.DriverProfile.set_Speed(GeoRoadType.geoRoadInterstate, 120);
                route.DriverProfile.set_Speed(GeoRoadType.geoRoadLimitedAccess, 120);
                route.DriverProfile.set_Speed(GeoRoadType.geoRoadOtherHighway, 90);
                route.DriverProfile.set_Speed(GeoRoadType.geoRoadStreet, 50);
    
                route.DriverProfile.StartTime = System.DateTime.Now;
                route.Calculate();
                // this hide the direction form
                mp.ItineraryVisible = false;

  6. #6
    AUR
    AUR is offline Junior Member White Belt
    Join Date
    Dec 2006
    Posts
    11

    Re: Automating Access and Mappoint

    Hello

    Can anyone please let me know how the map point can be displayed in an access 2003 form as it keeps on giving errors like "Map point failed to load" etc.

    I've searched on this forum but i couldnt find the solution. Some people says its because of XP SP2 incompabilities. Some people says use Access 2000. The latter solution didnt work infact with the removal of SP2 underlying OS would be vulnerable which clients cant bear.

    I'm trying to integrate Access2003 with MP2004. What i want to do is to calculate the shortest distance between the two streets as selected in the drop down combo boxes and the map point would automatically calculate the shortest distance as soon as the two fields are populated.

    Any help and coding would really be admired and appreciated.

    regards
    AUR

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

    Re: Automating Access and Mappoint

    Hi,

    I have no knowledge about VBA, but did you tryed to show the form with only the activex control on it ? If this works then you are already sure all references are ok. next step is to load a map with NewMap method. Do you get that far ? Does mappoint standalone executable runs fine ?

  8. #8
    AUR
    AUR is offline Junior Member White Belt
    Join Date
    Dec 2006
    Posts
    11

    Re: Automating Access and Mappoint

    Hello Wilfried
    thanks for replying

    i' using this code on form's open event

    Form_testform!ActiveXCtl10.NewMap geoMapEurope

    this works just fine when you place a control for the first time from the toolbox and open the form at runtime and the map gets loaded in activex control, but when you close the form and reopen it again , it starts giving suspicious errors identified previously.

    Also my standalone mp2004 is working fine.

    i've read several posts, some people are successful in integrating this but i dont know whats the actual code to open it and close.

    May be something needs to be done when you'r closing the form , for example i'm using the following code on form's unload event

    Form_testform!ActiveXCtl10.ActiveMap.Saved = True

    I believe there's not enough issue with the code which is just intended for
    loading the map point but can anyone highlight on the issues regarding XP SP2 incompabilities identified previously etc.

    thanks

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

    Re: Automating Access and Mappoint

    Hi,

    I will try. Ok, so the first time it works ok, second time it dont. So this let met concluding that all there is needed to load is ok, because otherwise it should not load without errors the first time.

    So maybe something is wrong when the form is destroyed. Can you do the following test:

    - Open task manager and search for mappoint.exe it should not be there. if it is then kill it.
    - Start your application, still no mappoint.exe should be there.
    - Create your form where the control i sitting on. Now you should have 1 inctance of mappoint.exe in memory.
    - Destroy the form and check again. There should be no instances left of mappoint.exe

    If there is now still an instance of mappoint.exe then there is something wrong when the form is destroyed. But that we see eventually in next step.

  10. #10
    AUR
    AUR is offline Junior Member White Belt
    Join Date
    Dec 2006
    Posts
    11

    Unhappy Re: Automating Access and Mappoint

    Yes i can see an instance which gets started when my form is loaded and destroyed when my form is destroyed. So instance creation of Mappoint.exe is normal in the task manager is normal.

    Again when i load my form i see the run time error message

    'Map point failed to load. The cause of this failure is unknown'

    Again i'm using Access 2003 with mp2004 using active x control 11.0 which comes with it.
    OS: WinXP SP2


    HELP!

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Automating Mappoint using VB
    By vennamreddy in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-07-2004, 06:19 AM
  2. Automating Mappoint
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 07-26-2004, 03:29 PM
  3. Automating MapPoint with Perl
    By Eric Frost in forum MP2K Magazine Articles
    Replies: 12
    Last Post: 07-15-2004, 03:44 PM
  4. Automating MapPoint with Perl
    By Eric Frost in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 08-08-2003, 06:10 PM
  5. Automating MapPoint with the .NET SDK
    By Anonymous in forum MP2K Magazine Articles
    Replies: 2
    Last Post: 10-21-2002, 06: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