Using OpenRecordset: Type mismatch

  • Thread starter Thread starter Lara
  • Start date Start date
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.
 
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.
 
Back
Top