Type mismatch initializing recordset variable?

  • Thread starter Thread starter Jim Bufalo
  • Start date Start date
J

Jim Bufalo

I'm getting a type mismatch in the following code. I may be
overlooking something really obvious - it seems pretty
straightforward :

Dim dbs As Database
Dim tdf As Tabledef
Dim Bal_rst As Recordset

Set dbs = CurrentDb
Set tdf = dbs.TableDefs!Det_trans_2000_Query1
Set Bal_rst = dbs.OpenRecordset("Balances", dbOpenTable)

"Balances" is the name of a table. It's spelled correctly yet
everytime I get a type mismatch on the OpenRecordset statement.

Thanks in advance!
Jim Bufalo
 
You need:
Dim Bal_rst As DAO.Recordset

The ADO library also has a Recordset object.

More info on these references:
http://allenbrowne.com/ser-38.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

I'm getting a type mismatch in the following code. I may be
overlooking something really obvious - it seems pretty
straightforward :

Dim dbs As Database
Dim tdf As Tabledef
Dim Bal_rst As Recordset

Set dbs = CurrentDb
Set tdf = dbs.TableDefs!Det_trans_2000_Query1
Set Bal_rst = dbs.OpenRecordset("Balances", dbOpenTable)

"Balances" is the name of a table. It's spelled correctly yet
everytime I get a type mismatch on the OpenRecordset statement.

Thanks in advance!
Jim Bufalo
 
Back
Top