Man, this problem is driving me bonkers. ThornMstr has been helping me out bit by bit, but I don't like bothring him he's a busy man - besides I'd rather bother you guys. ;-)
Ok .. here's the deal. I got this database from
It uses MapPoint 2002. It's an incredibly slick database, but it's designed for Access 2000 and up. It runs great on my copy of Ac2k, but I need it to work in AC97. Well, I converted it, then I compiled all the modules with AC97, compacted it... and then tried to use it. Here's where I got nothing when I tried tried to map it. WOrks in 2k, not in 97.
So I debug the piss out of the thing and find that it's giving me hell with recordsets.
The problem I get is in defining my recordsets. If you don't mind, please scroll through and make some suggestions. You'll see the remarked failures that I attempted to use as well, all seem to give me the same "Error 13: Type Mismatch" error. The problem is near the top, so don't freak out over the giant function. It's near the top where I declare everything.
The function looks like this:
Sub MapSelectedProperties()
'Map the selected properties
'On Error GoTo MapSelectedProperties_Err_Exit ' Uncomment when it works
Dim db As Database
Dim rstProps As Recordset
Dim sSQl As String
Dim objLoc As MapPoint.Location
Dim objMap As MapPoint.Map
Dim objPushpin As MapPoint.Pushpin
Dim strMsg As String
Dim i As Integer
i = 0
Set db = CurrentDb()
'sSQl = "SELECT * FROM TBLPROPERTIES WHERE YSNSELECTED = True"
'Set rstProps = db.OpenRecordset(sSQl, dbOpenSnapshot)
'Load the selected properties into a recordset
'Set rstProps = db.OpenRecordset("SELECT * FROM tblProperties WHERE ysnSelected = Yes;"
Set rstProps = db.OpenRecordset("qrySelectedTrue"
, dbOpenSnapshot) 'I've tried dbOpenDynaset, OpenTable, etc. - I get diff errors with diff types.
'Make sure at least one property was selected
If rstProps.RecordCount > 0 Then
'Load Map
If LoadMap() Then
'Open the form containing the map
FormOpen "frmMap"
Set objMap = gappMP.ActiveMap
'Place a pushpin on the map for each selected property
While Not rstProps.EOF
i = i + 1
Set objLoc = objMap.FindAddressResults(rstProps!strStreet, rstProps!strCity, rstProps!strState, rstProps!strPostalCode)(1)
Set objPushpin = objMap.AddPushpin(objLoc, rstProps!strStreet)
objPushpin.Name = CStr(i)
objPushpin.Note = "$" & rstProps!curListPrice
objPushpin.BalloonState = geoDisplayBalloon
objPushpin.Symbol = 77
objPushpin.Highlight = True
rstProps.MoveNext
Wend
'Show all pushpins on the map display
objMap.DataSets.ZoomTo
Else
strMsg = "Unable to load map."
MsgBox strMsg, vbOKOnly + vbExclamation, APP_NAME
End If
Else
strMsg = "No properties selected."
MsgBox strMsg, vbOKOnly + vbExclamation, APP_NAME
End If
MapSelectedProperties_Err_Exit:
On Error Resume Next
Set objPushpin = Nothing
Set objLoc = Nothing
Set objMap = Nothing
rstProps.Close
db.Close
Exit Sub
MapSelectedProperties_Err:
Resume MapSelectedProperties_Err_Exit
End Sub
C'mon you geniuses. You can figure this out with me.. ;-)
-Josh ------------------
-JPeters
Got a helpful tip for Access Users? Check out and contribute to 'How to Keep Your Databases from becoming Overwhelming!'
thread181-293590
jpeters@guidemail.com
------------------
Ok .. here's the deal. I got this database from
It uses MapPoint 2002. It's an incredibly slick database, but it's designed for Access 2000 and up. It runs great on my copy of Ac2k, but I need it to work in AC97. Well, I converted it, then I compiled all the modules with AC97, compacted it... and then tried to use it. Here's where I got nothing when I tried tried to map it. WOrks in 2k, not in 97.
So I debug the piss out of the thing and find that it's giving me hell with recordsets.
The problem I get is in defining my recordsets. If you don't mind, please scroll through and make some suggestions. You'll see the remarked failures that I attempted to use as well, all seem to give me the same "Error 13: Type Mismatch" error. The problem is near the top, so don't freak out over the giant function. It's near the top where I declare everything.
The function looks like this:
Sub MapSelectedProperties()
'Map the selected properties
'On Error GoTo MapSelectedProperties_Err_Exit ' Uncomment when it works
Dim db As Database
Dim rstProps As Recordset
Dim sSQl As String
Dim objLoc As MapPoint.Location
Dim objMap As MapPoint.Map
Dim objPushpin As MapPoint.Pushpin
Dim strMsg As String
Dim i As Integer
i = 0
Set db = CurrentDb()
'sSQl = "SELECT * FROM TBLPROPERTIES WHERE YSNSELECTED = True"
'Set rstProps = db.OpenRecordset(sSQl, dbOpenSnapshot)
'Load the selected properties into a recordset
'Set rstProps = db.OpenRecordset("SELECT * FROM tblProperties WHERE ysnSelected = Yes;"
Set rstProps = db.OpenRecordset("qrySelectedTrue"
'Make sure at least one property was selected
If rstProps.RecordCount > 0 Then
'Load Map
If LoadMap() Then
'Open the form containing the map
FormOpen "frmMap"
Set objMap = gappMP.ActiveMap
'Place a pushpin on the map for each selected property
While Not rstProps.EOF
i = i + 1
Set objLoc = objMap.FindAddressResults(rstProps!strStreet, rstProps!strCity, rstProps!strState, rstProps!strPostalCode)(1)
Set objPushpin = objMap.AddPushpin(objLoc, rstProps!strStreet)
objPushpin.Name = CStr(i)
objPushpin.Note = "$" & rstProps!curListPrice
objPushpin.BalloonState = geoDisplayBalloon
objPushpin.Symbol = 77
objPushpin.Highlight = True
rstProps.MoveNext
Wend
'Show all pushpins on the map display
objMap.DataSets.ZoomTo
Else
strMsg = "Unable to load map."
MsgBox strMsg, vbOKOnly + vbExclamation, APP_NAME
End If
Else
strMsg = "No properties selected."
MsgBox strMsg, vbOKOnly + vbExclamation, APP_NAME
End If
MapSelectedProperties_Err_Exit:
On Error Resume Next
Set objPushpin = Nothing
Set objLoc = Nothing
Set objMap = Nothing
rstProps.Close
db.Close
Exit Sub
MapSelectedProperties_Err:
Resume MapSelectedProperties_Err_Exit
End Sub
C'mon you geniuses. You can figure this out with me.. ;-)
-Josh ------------------
-JPeters
Got a helpful tip for Access Users? Check out and contribute to 'How to Keep Your Databases from becoming Overwhelming!'
thread181-293590
jpeters@guidemail.com
------------------