28-Jul-2006, 08:17 AM
| || |
| || || || || |
| || |
Re: Run-time error '13': Type mismatch
Brilliant! Removing the ADO worked a treat. Thanks for your help.
"Dirk Goldgar" wrote:
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/10969-run-time-error-13-type-mismatch.html
> "calmo" wrote in message
> > This one is driving me mad! The database I'm working with is meant to
> > download data into Publisher to create posters, I have one version
> > that works and one that gives me the Run-time error. The query
> > works, the code looks right, and just to make life interesting, I
> > created a new copy of the database importing all of the tables,
> > queries, forms, posters and macros from the version that works, and I
> > still get the same error message! I know this isn't much info, but
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10969
> > if anyone else has come across anything similar, at least I won't
> > feel like I'm going completely mad!!
> It would help a lot if you posted the line of code that is raising the
> error. I do have one guess: we often see questions about this error
> that are due to a confusion over the Recordset type. For example, in an
> Access 2000 or 2002 database, there will be code like this:
> Dim rs As Recordset
> Set rs = CurrentDb.OpenRecordset(" ... ")
> and the error will be raised on the call to OpenRecordset. That's
> caused by A2K/A2K2 not having a default reference set to the DAO
> library, but instead having a reference to the ADODB library. Both of
> those libraries define a Recordset object, but they're not compatibile.
> So in the above code, the declaration is understood by VBA as making rs
> an ADODB.Recordset, but the OpenRecordset method returns a DAO
> recordset. So you get a type mismatch error.
> If this is your problem, you must first use the Tools -> References...
> dialog to add a reference to the Microsoft DAO 3.6 Object Library (if it
> isn't there already), and then *either* remove the reference to ActiveX
> Data Objects 2.x Library (if you don't plan to use ADO) *or* change your
> declaration of the recordset to:
> Dim rs As DAO.Recordset
> By explicitly identifying the library whose Recordset object you're
> declaring, you remove the confusion.
> There are other objects that are defined in both libraries and can cause
> confusion. The full list is:
> Note: the following objects exist with the same names in the ADOX and
> DAO models as well:
> Dirk Goldgar, MS Access MVP
> (please reply to the newsgroup)