MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Automating Access and Mappoint

This is a discussion on Automating Access and Mappoint within the MapPoint 2006/2009 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, ...


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

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-18-2006
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
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 09-19-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 09-19-2006
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,322
Blog Entries: 1
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 10-17-2006
Junior Member
Yellow Belt
 
Join Date: Jun 2006
Posts: 14
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 10-19-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
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;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 12-23-2006
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 12-23-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
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 ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 12-23-2006
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 12-24-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10 (permalink)  
Old 12-24-2006
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!
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


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
Automating Mappoint using VB vennamreddy MapPoint 2006/2009 Discussion 1 10-07-2004 05:19 AM
Automating Mappoint Anonymous MapPoint 2006/2009 Discussion 3 07-26-2004 02:29 PM
Automating MapPoint with Perl Eric Frost MP2K Magazine Articles 12 07-15-2004 02:44 PM
Automating MapPoint with Perl Eric Frost MapPoint 2006/2009 Discussion 0 08-08-2003 05:10 PM
Automating MapPoint with the .NET SDK Anonymous MP2K Magazine Articles 2 10-21-2002 05:41 PM


All times are GMT -5. The time now is 05:55 AM.


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

Flights Lanzarote
Volcanic landscapes to explore and warm white sandy beaches to relax on. For flights to Lanzarote search Holiday Hypermarket.

Best Travel Agent
Travel Counsellors has been named the UK's Best Travel Agent at the Guardian Unlimited Travel awards.

Cheap Flight Canada
Making a cheap flight to Canada can become a reality when you book online with dealchecker.co.uk. Our simple search allows you to see for yourself who is the cheapest.

Holidays to Sri Lanka
Holidays to Sri Lanka are enriched by the glittering tapestry of culture and breath taking mountain views. Book a holiday there today!

Turkey
Before booking a holiday to Turkey check out the ULookUBook travel guide. Find out about the rich culture in Turkey before you go there to help you to make the most of your holiday.

Holiday Comparison
We can help you with holiday comparison when you check out the options at Travel.co.uk

Cheap Cyprus Holidays
Rejuvenate mind and body! Visit the Mediterranean! Cheap Cyprus holidays can be viewed at On The Beach!


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