Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

This Dang Set Recordset is giving me a Type Mismatch error

Status
Not open for further replies.

JPeters

MIS
Jul 25, 2001
423
0
0
US
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
------------------
 
This line doesn't look right:
Set rstProps = db.OpenRecordset("qrySelectedTrue"), dbOpenSnapshot)
It should be:
Set rstProps = db.OpenRecordset("qrySelectedTrue", dbOpenSnapshot)
Notice I took out the right parenthesis. However, the lines commented out look ok though. So I doubt this is your problem.
 
Yeah, I got that. I had the dbOpenTable remmed out earlier and when I posted forgot to hit the final backspace. Heh, this is a frustrating problem...

-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
------------------
 
Josh,


If I remember correctly, the one recordset which consistently failed was this one:
'sSQl = "SELECT * FROM TBLPROPERTIES WHERE YSNSELECTED = True"
'Set rstProps = db.OpenRecordset(sSQl, dbOpenSnapshot)

If that is correct, are you absolutely positive that YSSELECTED is boolean. You only have two datatypes...YSNSELECTED and the value of True.

And yet one more possibly very silly question. Do you have any idea as to the maximum size of this recorset, ie, max nbr of records. Is there any chance of it going over
10,000.

And,last for the moment, are you using JET or one of its BIG BROTHERS. Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Robert,
Only using 70 records, so that shouldn't be the problem. And at most I'll be using around 3,000 in the future.
The ysnSelected field is setup as a Yes/No (true false)field, so I'm sure that this isn't the problem either.
We'll get this eventually. I'm going to try a few of your earlier suggestions again, Robert. Thanks.

-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
------------------
 
Josh,

Have you tried replacing your YES,NO,TRUE,FALSE with -1 and 0. I have had problems along these lines before.

I also assume qrySelectedTrue runs independently of your subroutine?

B.





 
Figged it out. AC97 default is ADo, not DAO. This thing wasn't defaulting to DAO. Changed Set rstProps = Dao.Recordset and now it works like a champ. Woot woot! (don't see many woot's in this forum, I decided we need a few).

-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
------------------
 
Josh,

You're so happy you've become dyslexsic. A97 Defaults to DAO. A2K defaults to ADO. Since this OCX was expecting ADO (A2K derived) you had to specify DAO.

"WHOOT". Do you perhaps mean "WHOOP" or my usual commentary of simply. "SNORT".

Glad you got it resolved. Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Dyslexic? I think I'm just incoherent... ;-)


Oh, and directly from
w00t!

Use it as an interjection or a celebratory statement! As in...'Hey! I just upgraded my 56k modem to 1.1 SDSL. w00t! w00t!'. Works every time. True it's an independent clause, but really the best clauses are always independent. w00t.

w00t belongs to gamers the world over. It seems to have been derived from the obselete 'whoot' which essentially is another way to say 'hoot' which itself is a shout or derisive laugh. But others maintain that w00t is the sound several players make while jumping like bunnies in Quake III. Still others want you to believe that it comes from the phrase 'wow loot' used in multiplayer RPGs many moons ago. Fiction or fact? I suppose you'll just have to decide what 'w00t!' means to you...

Sorry to break from the professional Access developer facade... I'll get back to that immediately. [lol]

-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
------------------
 
SNORT!.

Back to developer mode. Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top