MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




mappoint in access

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 ...


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

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-18-2006
Junior Member
White Belt
 
Join Date: Jan 2006
Posts: 9
mappoint in access

Can some one help me with this access vba code please
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
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 01-19-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
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
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 01-20-2006
Junior Member
White Belt
 
Join Date: Jan 2006
Posts: 9
im using mappoint 2004 ms access xp
if i put another end if in public function ApplyPoint()
the code won't work
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 01-22-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
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, "");
'loc' is your Location object in AddPushpin: oLoc(1).Location; and in the second argument you add the name, I think in your code: me.PickupCustomer;
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 01-25-2006
Junior Member
White Belt
 
Join Date: Jan 2006
Posts: 9
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
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

Tags
access, mappoint


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
MS Access Mappoint ActiveX Anonymous MapPoint 2006/2009 Discussion 2 05-21-2005 06:31 PM
MapPoint with Access Anonymous MapPoint 2006/2009 Discussion 0 03-26-2005 12:25 PM
Mappoint, SQL, and Access wiljane3 MapPoint 2006/2009 Discussion 2 03-11-2005 02:46 PM
Problem with mappoint in Access Dazzer MapPoint 2006/2009 Discussion 0 12-04-2003 05:27 AM
MapPoint in MS Access Anonymous MapPoint 2006/2009 Discussion 0 01-21-2003 06:23 PM


All times are GMT -5. The time now is 02:34 PM.


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


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