Type mismnatch

  • Thread starter Thread starter Bingo
  • Start date Start date
B

Bingo

I'm getting this repeatedly:

dim rs as ADODB.recordset
set rs = me.recordset

I get a 'type mismatch'

I can get aaround it by

dim rs as Object
set rs=me.recordset

But WHY do I need to do this?

I'm using an access database, the "as installed" references,
standard "as installed" VBA, etc.
 
Hi Bingo,

Try using a DAO recordset instead - I'm not certain why an ADO recordset
won't work - I think it should but I can't get it to work either.

dim rs as DAO.recordset

You also have to make sure that you have a reference set to DAO for this to
work.
 
Aren't form recordsets in DAO format, not ADODB?

--
Ken Snell
<MS ACCESS MVP>

Sandra Daigle said:
Hi Bingo,

Try using a DAO recordset instead - I'm not certain why an ADO recordset
won't work - I think it should but I can't get it to work either.

dim rs as DAO.recordset

You also have to make sure that you have a reference set to DAO for this to
work.

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.

I'm getting this repeatedly:

dim rs as ADODB.recordset
set rs = me.recordset

I get a 'type mismatch'

I can get aaround it by

dim rs as Object
set rs=me.recordset

But WHY do I need to do this?

I'm using an access database, the "as installed" references,
standard "as installed" VBA, etc.
 
I thought so, and wanted to double check in Help and here's the first line:

"Returns or sets the ADO Recordset or DAO Recordset object representing the
record source for the specified form, report, list box control, or combo box
control. Read/write"

I think that the recordset is ADO if you are using SQL data, and DAO if you
are using Jet data - though according to the help - it would appear that you
could have an ADO recordset when using Jet. The details on this are a bit
vague.

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.

Ken said:
Aren't form recordsets in DAO format, not ADODB?


Sandra Daigle said:
Hi Bingo,

Try using a DAO recordset instead - I'm not certain why an ADO recordset
won't work - I think it should but I can't get it to work either.

dim rs as DAO.recordset

You also have to make sure that you have a reference set to DAO for this
to work.

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.

I'm getting this repeatedly:

dim rs as ADODB.recordset
set rs = me.recordset

I get a 'type mismatch'

I can get aaround it by

dim rs as Object
set rs=me.recordset

But WHY do I need to do this?

I'm using an access database, the "as installed" references,
standard "as installed" VBA, etc.
 
Sandra Daigle said:
I think that the recordset is ADO if you are using SQL data, and DAO if you
are using Jet data - though according to the help - it would appear that you
could have an ADO recordset when using Jet. The details on this are a bit
vague.

I agree about the vagueness. I always used DAO recordsets with forms, and
this issue hadn't arisen. So another new thing learned today!
 
Hi Ken,

I thought about it a little bit more and I think the way you could have an
ADO recordset (as the form's recordset of course) with Jet is to explicitly
set the recordset property of the form to an ADO recordset. I'm pretty sure
you can do it that way - perhaps the help could be a little less vague on
this.
 
Oh yeah, one more thing . . . I've used ADO for just about nothing. Mostly
for random testing. I'm far more comfortable with DAO and since it isn't
going away I'm happy with it until I bite the bullet and learn ADPs and SQL
Server.
 
I agree about the vagueness. I always used DAO recordsets with
forms, and this issue hadn't arisen. So another new thing
learned today!

Thank you all for the research. I thought my fuzziness was due to my
still newbie-ness with Access, but it seems it's just Microsoft
again!
 
Back
Top