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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error msg 13 Type Mismatch, How to Debug 1

Status
Not open for further replies.

bsupport

Programmer
Dec 20, 2000
53
US
I'm getting an error msg code 13, Type mismatch.

In an Access 2000 module, I have the following code:

Sub AddItemsToTable(ItemType As String, SelectedItem As Variant, Optional SelectedOptional As Variant)
Dim strItemType As String
Dim varSelected As Variant
Dim varSelectOpt As Variant
Dim strMsg As String
Dim strTitle As String
Dim db As Database
Dim rst As Recordset

Set db = CurrentDb()
Set rst = db.OpenRecordset("tblSelectedItems")

strItemType = ItemType
varSelected = SelectedItem
varSelectOpt = SelectedOptional
________________________________________________

One the line "Set rst = db.OpenRecord......"
is where this error msg is occurring.

Can anyone tell me why I am getting this?
Any help is appreciated!

Thanks
Who takes 7 seconds to develop,
7 mins to document,
7 hours to test,
7 months to fix will always blame the clock. s-)
 
Try dim-ing db and rst as DAO.Database and DAO.Recordset, respectively.

Hope that helps

joe
 
Check your tool - reference - make sure Microsoft DAO 3.6 is checked instead of ADO 2.1 Library.
 
Thanks SIG357! :)I That did the trick.

And to TTThio--Thank you, that was the first place I checked when I got the error message, still I appreciate your response.

You never no if someone will respond to your question, so when someone does it is always greatly appreciated.

THANKS TO ALL WHO HELP US! Who takes 7 seconds to develop,
7 mins to document,
7 hours to test,
7 months to fix will always blame the clock. s-)
 
Try
Set rst = db.OpenRecordset("select * from tblSelectedItems")
instead of
Set rst = db.OpenRecordset("tblSelectedItems")

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top