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

mappoint in access

This is a discussion on mappoint in access within the MapPoint Desktop 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 ...

  1. #1
    nmilne is offline 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

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    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&#40;&#41;
    	If txtAddress <> "" Then
    		ApplyPoint
    	End If
    End Sub
    
    Private Sub Form_Close&#40;&#41;
    	oMap.ActiveMap.Saved = True
    	Set objSA = Nothing
    	Set oLoc = Nothing
    	Set oPush = Nothing
    	Set oMap = Nothing
    End Sub
    
    Private Sub Form_Load&#40;&#41;
    	Set oMap = MapCtl.Object
    	oMap.NewMap geoMapEurope
    	txtAddress = "Me.txtpickupAddress"
    End Sub
    
    Public Function ApplyPoint&#40;&#41;
    	If oMap Is Nothing Then 
    		Set oMap = Me!MapCtl.Object
    		Set objSA = oMap.ActiveMap.ParseStreetAddress&#40;txtAddress&#41;
    		Set oLoc = oMap.ActiveMap.FindAddressResults&#40;objSA.Street, objSA.City _, , objSA.Region, objSA.PostalCode&#41;
    		If Not oLoc Is Nothing And oLoc.ResultsQuality <> geoNoResults Then
    			Set oPush = oMap.ActiveMap.AddPushpin&#40;oLoc&#40;1&#41;.Location, me.PickupCustomer&#41;
    			oPush.BalloonState = geoDisplayName
    			oPush.Location.GoTo
    			Set oPush = Nothing
    			Set oLoc = Nothing
    		End If
    End Function

  3. #3
    nmilne is offline 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

  4. #4
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    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&#40;loc, ""&#41;;
    '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;

  5. #5
    nmilne is offline 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

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. MS Access Mappoint ActiveX
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 05-21-2005, 06:31 PM
  2. MapPoint with Access
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 03-26-2005, 12:25 PM
  3. Mappoint, SQL, and Access
    By wiljane3 in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 03-11-2005, 02:46 PM
  4. Problem with mappoint in Access
    By Dazzer in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 12-04-2003, 05:27 AM
  5. MapPoint in MS Access
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 01-21-2003, 06:23 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