Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

don't know coding for vba access please help

0 views
Skip to first unread message

nickmilne

unread,
Jan 18, 2006, 1:48:04 PM1/18/06
to
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


Gilles Kohl [MVP]

unread,
Jan 18, 2006, 5:43:38 PM1/18/06
to
On Wed, 18 Jan 2006 10:48:04 -0800, nickmilne
<nick...@discussions.microsoft.com> wrote:

>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

Check out the ActiveRoute object of the map. Clear it to start a new
route, then add location or pushpin objects (at least two of course)
to its WayPoints collection.

(

oMap.ActiveRoute.Waypoints.Add oPush

should work in your context - optionally provide a name for the stop

)

Finally, call ActiveRoute.Calculate to calculate the route. Results
such as driving time or distance are then available as properties of
the ActiveRoute.

Regards,
Gilles [MVP].

(Please reply to the group, not via email)

nickmilne

unread,
Jan 19, 2006, 8:21:02 AM1/19/06
to
I did as you said an I still cant get it to work need help from a Access
programming

Michael R Mattys

unread,
Jan 19, 2006, 10:12:49 AM1/19/06
to
"nickmilne" <nick...@discussions.microsoft.com> wrote in message
news:70ACC1AC-0D13-4BFF...@microsoft.com...

> I did as you said an I still cant get it to work need help from a Access
> programming

Nick,

Gilles gave you the answer to adding a WayPoint to the WayPoints collection
of the ActiveRoute and it does not require Access. You simply need to tell
the
ActiveRoute to Calculate and/or Optimize once you've finished adding points.

For database design and programming topics, try the following:
Access-L
http://peach.ease.lsoft.com/archives/access-l.html#SUB
Access-D
www.databaseadvisors.com

Both groups have searchable archives.

www.rogersaccesslibrary.com for sample Access databases.
www.mp2kmag.com for articles using Access and MapPoint.

----

Michael R. Mattys
Mattys MapLib for Microsoft MapPoint
http://www.mattysconsulting.com


0 new messages