Recordset: Type Mismatch

J

jouj

Hi,
I'm Using MS Access XP.
In my VBA Code, sometimes I encounter this error when running a function
from VBA: "Type Mismatch" on the line:
[Dim Rst as RecordSet]
--> Set Rst = Currentdb.OpenRecordSet (sql statement)
.....
Or "Method not found" on the line:

--> Rst.Edit

In my references library list, I have the "Microsoft DAO 3.6 Object Library".
So I wonder why I'm getting this error knowing that my code was running
normaly before that and I haven't changed it.

Thanks in advance.
 
J

jouj

Hi Again,
I changed my code to:
Dim Rst as DAO.RecordSet
and it worked fine.
It seems that I have a lot of Libraries providing the RecordSet Class.

Thanks for All and If you have comments or Articles, I will be glad to get it.

Thanks again.
 
6

'69 Camaro

Hi.
In my references library list, I have the "Microsoft DAO 3.6 Object Library".
So I wonder why I'm getting this error knowing that my code was running
normaly before that and I haven't changed it.

The ADO library is interfering with the DAO library, since both contain the
Recordset object. You can avoid this problem by either specifically
declaring the DAO Recordset instead of the Recordset of the library of the
highest library by using the following in your declaration:

Dim Rst as DAO.RecordSet

Or you can set the DAO library to have higher precedence than the ADO
library in your database's References Collection. For more information on
these library references, please see Tom Wickerath's tip: "ADO and DAO
Library References in Access Databases" on the following Web page:

http://www.Access.QBuilt.com/html/gem_tips1.html

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)

- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts, so that all
may benefit by filtering on "Answered questions" and quickly finding the
right answers to similar questions. Remember that the best answers are often
given to those who have a history of rewarding the contributors who have
taken the time to answer questions correctly.


jouj said:
Hi,
I'm Using MS Access XP.
In my VBA Code, sometimes I encounter this error when running a function
from VBA: "Type Mismatch" on the line:
[Dim Rst as RecordSet]
--> Set Rst = Currentdb.OpenRecordSet (sql statement)
....
Or "Method not found" on the line:

--> Rst.Edit

In my references library list, I have the "Microsoft DAO 3.6 Object Library".
So I wonder why I'm getting this error knowing that my code was running
normaly before that and I haven't changed it.

Thanks in advance.
 
T

Tim Ferguson

It seems that I have a lot of Libraries providing the RecordSet Class.

Thanks for All and If you have comments or Articles, I will be glad to
get it.

Two: the ADODB and DAO libraries both have Recordset objects. If you don't
want to use the ADODB objects, you can uncheck them in the references list;
or you can just move the DAO library above the ADODB in the list; or you
can continue to disambiguate everything with ADO.Something and
ADODB.SomethingElse. Or a combination of the above.

Hope that helps


Tim F
 

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