Type mismatch initializing recordset variable?

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
 
A

Allen Browne

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top