Community of MapPoint and Virtual Earth Users and Developers
This is a discussion on mappoint in access within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Can some one help me with this access vba code please I want it to add the waypoint (1) after ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| mappoint in access I want it to add the waypoint (1) after the addpushpin(1) I don’t know how to do this Option Compare Database Option Explicit Private oMap As MapPoint.MappointControl Private oCustomers As MapPoint.DataSet Private objSA As MapPoint.StreetAddress Private oPush As Pushpin Private oLoc As Object Private Sub cmdPlot_Click() If txtAddress <> "" Then ApplyPoint End If End Sub Private Sub Form_Close() oMap.ActiveMap.Saved = True Set objSA = Nothing Set oLoc = Nothing Set oPush = Nothing Set oMap = Nothing End Sub Private Sub Form_Load() Set oMap = MapCtl.Object oMap.NewMap geoMapEurope txtAddress = "Me.txtpickupAddress" End Sub Public Function ApplyPoint() If oMap Is Nothing Then Set oMap = Me!MapCtl.Object Set objSA = oMap.ActiveMap.ParseStreetAddress(txtAddress) Set oLoc = oMap.ActiveMap.FindAddressResults(objSA.Street, objSA.City _ , , objSA.Region, objSA.PostalCode) If Not oLoc Is Nothing And oLoc.ResultsQuality <> geoNoResults Then Set oPush = oMap.ActiveMap.AddPushpin(oLoc(1).Location, me.PickupCustomer) oPush.BalloonState = geoDisplayName oPush.Location.GoTo Set oPush = Nothing Set oLoc = Nothing End If End Function |
| |||
|
Hi, which waypoint ? There is also an endif missing, see copy of your code below with indent. Please use code tags next time so that code is more readeable. Code: Option Compare Database Option Explicit Private oMap As MapPoint.MappointControl Private oCustomers As MapPoint.DataSet Private objSA As MapPoint.StreetAddress Private oPush As Pushpin Private oLoc As Object Private Sub cmdPlot_Click() If txtAddress <> "" Then ApplyPoint End If End Sub Private Sub Form_Close() oMap.ActiveMap.Saved = True Set objSA = Nothing Set oLoc = Nothing Set oPush = Nothing Set oMap = Nothing End Sub Private Sub Form_Load() Set oMap = MapCtl.Object oMap.NewMap geoMapEurope txtAddress = "Me.txtpickupAddress" End Sub Public Function ApplyPoint() If oMap Is Nothing Then Set oMap = Me!MapCtl.Object Set objSA = oMap.ActiveMap.ParseStreetAddress(txtAddress) Set oLoc = oMap.ActiveMap.FindAddressResults(objSA.Street, objSA.City _, , objSA.Region, objSA.PostalCode) If Not oLoc Is Nothing And oLoc.ResultsQuality <> geoNoResults Then Set oPush = oMap.ActiveMap.AddPushpin(oLoc(1).Location, me.PickupCustomer) oPush.BalloonState = geoDisplayName oPush.Location.GoTo Set oPush = Nothing Set oLoc = Nothing End If End Function
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Hi, Ok, sorry I tought that if then block in VB must be closed with end if, but I know not mutch of VB. But reading again I now think I understeand what your question was. You have this location where you put the pushpin and wants to add a waypoint to a route right ? Here it go (in C#): Code: Waypoint wp;
Map map = mp.ActiveMap;
Route route = map.ActiveRoute;
wp = route.Waypoints.Add(loc, "");
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| sorted
thank for the help i have now found the info i needed in ms access press the obect browser button then in all libraries change it to mappoint and all the comands are there i have now got my mappoint working in database on a form like lookup pickup customer press the add to map button this then finds customer and then add it as pushpin pluse route start then the same for my delivery address this then calc the route then passes back to the database the info i need like map of route + directions + time to do job + route cost + miles total im very pleased with it all i needed to do was find out the name diff from vb to vba then some playing round with code all the best nick |
![]() |
| Tags |
| access, mappoint |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MS Access Mappoint ActiveX | Anonymous | MapPoint 2006/2009 Discussion | 2 | 05-21-2005 05:31 PM |
| MapPoint with Access | Anonymous | MapPoint 2006/2009 Discussion | 0 | 03-26-2005 11:25 AM |
| Mappoint, SQL, and Access | wiljane3 | MapPoint 2006/2009 Discussion | 2 | 03-11-2005 01:46 PM |
| Problem with mappoint in Access | Dazzer | MapPoint 2006/2009 Discussion | 0 | 12-04-2003 04:27 AM |
| MapPoint in MS Access | Anonymous | MapPoint 2006/2009 Discussion | 0 | 01-21-2003 05:23 PM |
Tenerife Holiday
Find a great deal on a Tenerife holiday through UlookUbook! Check out the options online...