View Single Post

  #4 (permalink)  
Old 06-21-2004
Taab Taab is offline
Junior Member
White Belt
 
Join Date: Jun 2004
Posts: 4
Errors with Access

I am trying to display MapPoint maps in Access just like the one in this article.

I am cutting and pasting the code into access 2003 and using MapPoint 2004 Trial.

The errors seem to center aroung the "objMap" object.

Set objMap = MPC.NewMap(geoMapNorthAmerica)

Run-time error 91
Oject variable or With block variable not set

Run-time error 438
Object doesn't support this property or method

This is the code I am using:

Dim objMap As MapPoint.Map
Dim objPin As MapPoint.Pushpin

Sub Form_Load()

Set objMap = MPC.NewMap(geoMapNorthAmerica)
MPC.Toolbars.Item("Navigation").Visible = True

'This is done in the Form_Load so that the DataSets(1).Delete does not bomb in Form_Current the first time it is run
Set objPin = objMap.AddPushpin(objMap.FindAddressResults(Me!Pro pAddress(P), Me!PropCity(P), , Me!PropState(P),
Me!PropZipPlus4(P))(1))

For Each objPlaceCat In objMap.PlaceCategories
objPlaceCat.Visible = False
Next

End Sub

Private Sub Form_Current()

objMap.DataSets(1).Delete
Set objPin = objMap.AddPushpin(objMap.FindAddressResults(Me!Pro pAddress(P), Me!PropCity(P), , Me!PropState(P),
Me!PropZipPlus4(P))(1))
objPin.Symbol = 57

objMap.DataSets.ZoomTo

End Sub

Private Sub Form_Unload(Cancel As Integer)
objMap.Saved = True
End Sub

I renamed my control to "MPC" and changed the address references.

Any ideas?

Thanks,

Tracy Lowell
Reply With Quote