Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / April 2005

Tip: Looking for answers? Try searching our database.

Why is a "mismatch" error (13) issued on Openrecordset?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Harry - 06 Jan 2005 16:49 GMT
Attempting to add combobox item not in list. Code. used worked in earlier
versions. Using:   Set DB=DBENGINE.Workspaces(0).Databases(0).  Set
RS=DB.Openrecordset("tablename"). The last statement issues a type mismatch
error (error=13), therefore, not getting to update tablename with newdata
value. I have also tried diffent parameters in the last statement to no
avail. I have also set Limit to list  to "No" for the notinlist event to be
called. Would appreciate any help.  Thanks
Brendan Reynolds - 06 Jan 2005 17:00 GMT
Most likely you have references to both the DAO and ActiveX Data Objects
(ADODB) libraries, which both contain objects with the name 'Recordset'. If
you don't specify which type of recordset you want, VBA will use which ever
library appears first in the list of references. The DAO OpenRecordset
method returns a DAO recordset, so if you attempt to assign that to an ADODB
recordset, you get a type mismatch error. To avoid it, 'disambiguate' by
specifying the object library when declaring the recordset variable, e.g.
Dim rst As DAO.Recordset if you want a DAO recordset, and Dim rst As
ADODB.Recordset if you want an ADODB recordset.

Signature

Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.

> Attempting to add combobox item not in list. Code. used worked in earlier
> versions. Using:   Set DB=DBENGINE.Workspaces(0).Databases(0).  Set
[quoted text clipped - 5 lines]
> be
> called. Would appreciate any help.  Thanks
Harry - 06 Jan 2005 18:03 GMT
You hit the nail smacks on the head. I have been away too long from this
stuff. I incorporated your suggestion --- and the ole code works again.
Thanks Brenda --- I have my desk full of printed help docs with no mention of
your resolution. Thank you and have a great 2005.   Harry

> Most likely you have references to both the DAO and ActiveX Data Objects
> (ADODB) libraries, which both contain objects with the name 'Recordset'. If
[quoted text clipped - 15 lines]
> > be
> > called. Would appreciate any help.  Thanks
LeAnn - 22 Apr 2005 01:27 GMT
Not sure if you will see this since it is an old post BUT I just happened
along this thread and it answers a bug I encountered yesterday!!  I did a
work around but now I can use your solution.  Thanks so much!

> Most likely you have references to both the DAO and ActiveX Data Objects
> (ADODB) libraries, which both contain objects with the name 'Recordset'. If
[quoted text clipped - 15 lines]
> > be
> > called. Would appreciate any help.  Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.