PDA

Click to See Complete Forum and Search --> : Database open error 13 - type mismatch


tcurrier
Sep 9th, 1999, 07:25 PM
I'm getting a database open error 13 - type mismatch on the 'Set mydata - ... ' statement.
Can anyone help out ?
' ***************************************
Dim mydb As Database
Dim mydata As Recordset
On Error GoTo errHandler
Set mydb = Workspaces(0).OpenDatabase _
("C:\MDB\TOM3.MDB")
Set mydata = mydb.OpenRecordset _
("Table1", dbOpenTable)
' ****************************************

Andrew Herrmann
Sep 11th, 1999, 09:26 PM
I was banging my head against the wall on this one for a while. I did a lot of searching on the net and I came up with two things (I'm not sure which one did the trick, but it now works for me).

1) When you set up your recordset, specify DAO. For example:

dim rstNew as DAO.recordset

From what I understand, DAO isn't the first type that VB searches for. If you explicitly state that the recordset is a DAO type, there is no question.

2)I initially had a reference to the DAO 3.51 object library. I changed this to the DAO 2.5/3.51 Compatibility library.

I hope that this does the trick for you!