OpenRecordset: I would have thought this would work

P

plh

Please take a look at this:

Dim rsTemp As Recordset
Dim db As Database

................
.................
.................

Set db = CurrentDb

Set rsTemp = db.OpenRecordset("SELECT * FROM tblPrograms")

The last line results in a RT Error 13 e.g. Type Mismatch.
I am baffled.
db is set to the correct Database and there is in fact a table with the name
tblPrograms.
Thank You,
-plh
 
S

SusanV

What kind of recordset - ADO or DAO? Access wants to know. Also check that
you don't have any missing references.
 
D

Douglas J Steele

Dim rsTemp As DAO.Recordset

Assuming you have references set to both ADO and DAO, the ADO reference is
(usually) higher in the sort order so unqualified references will result in
an ADO recordset. Since you're trying to use DAO, that causes your error.
 
P

plh

Thank You, I am sure that will work. It is a little embarrassing because when I
read your answer it hit me that I asked this question of a very similar one
before, and got the same or a very similar answer.
-plh
 

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