View Single Post

  #2 (permalink)  
Old 01-19-2006
Wilfried Wilfried is offline
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,177
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
Reply With Quote