Using OpenRecordset: Type mismatch

L

Lara

Hi,

I have a piece of code, which gave me a "Runtime Error 13: Type
Mismatch". Is there anyone knows why?

The following code is included in a BeforeUpdate sub function.

Dim rst As ADODB.Recordset

Set rst = New ADODB.Recordset

Set rst = CurrentDb.OpenRecordset("tableName") <---Type Mismatch happens
here

Thanks a lot.
 
D

Douglas J. Steele

You're mixing DAO and ADO.

CurrentDb is a DAO object. If you use it to open a recordset, you must use a
DAO recordset.
 

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