Opening a Recordset

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to open a recordset using the simple code below:

Dim rst As Recordset

Set rst = CurrentDb.OpenRecordset("tblPayroll", dbOpenDynaset)

This is the identical code I am using in another Access Database (with the
exception of the table name) but with this one I get a "Type Mismatch" on
the "Set rst" line. The only thing I could think of was that I didn't have
my references set correctly but, they too are the same as in the other
database.

What obvious thing am I overlooking here?

Thanks,
Carl
 
You may need to disambiguate your declaration with:
Dim rst As DAO.Recordset

Depending on how your references are sequenced, your VBA may assume it is an
ADODB.Recordset unless you specify DAO.

TomU
 
Thank you - that resolved the issue.

Carl

TomU said:
You may need to disambiguate your declaration with:
Dim rst As DAO.Recordset

Depending on how your references are sequenced, your VBA may assume it is an
ADODB.Recordset unless you specify DAO.

TomU
 

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

Back
Top