VBA type mismatch on OpenRecordset

  • Thread starter Thread starter Sheryl
  • Start date Start date
S

Sheryl

The following code has a runtime error 'type mismatch' on
the OpenRecordset line.

dim db as Database
dim rs as Recordset
set db = Currentdb
Set rs = db.OpenRecordset("select * from RESULTS", _
dbOpenSnapshot)

The 'set db' line is ok, I can print db.Name. A table
RESULTS exists. I've tried various options for the 2nd
afgument, including omitting it. I'm using Access 2002.
 
there can be 2 types of recordsets - ado and dao
so try to declare explicity (DAO in your case):

dim rs as DAO.Recordset
 
Back
Top