Re: Compile error when converting from A2003 to A2007

Tech-Archive recommends: Fix windows errors by optimizing your registry



Whilst Gunny's answer is impeccable, I have always used ONLY DAO and never
ADO.

This is probably because I learned from older versions, and found no reason to
convert to or use ADO (and it is not recommended if you only use JET
databases). ADO never took off really, even though it's a "default" in later
Access.

IF you ONLY use DAO, it IS NOT NECESSARY to disambiguate code. Merely remove
the ADO reference will fix it.

It is possible that a conversion from one Access to another might re-establish
an ADO reference. But, in doing such a conversion, one should go through the
references to see what is NECESSARY anyway. (and remove unnecessary ones).

Gunny's fix would fix the problem in all circumstances, no argument. But it
might also leave you with a never-used reference, which is also not a good
idea. More importantly, if the later version MDB is derived from "legacy
code", it IS NOT NECESSARY to disambiguate the code in the way Gunny (and
others) say. It can be resolved by being aware of the references.

I say, unless there is a specific reason, you SHOULD NOT HAVE both DAO and ADO
in the same MDB. Removing one or other reference is usually sufficient, rather
than the hassle of disambiguating code (only necessary if for some reason you
need BOTH references).

Of course, relying on Reference order is unreliable as Gunny says. REMOVING
ADO is perfectly reliable, assuming you do not use ADO, and that you check
references on any conversion. In the case of using only JET database, advice
seems to be that you wouldn't have any good reason to use ADO, which never
really established itself as the purported replacement for DAO.

(is this a sensible explanation or description, Gunny? It's more like an
alternate way of saying things which does not really conflict with yours?
Except, I've never needed to go through all the code and disambiguate!
Imagined downside only eventuates if one doesn't check references, and they DO
NOT alter on installations only in development?)(some of them may become
"missing" on installation, which is different from "altering")

Chris

"Howard Jacobs" <HowardJay@xxxxxxxxxx> wrote in message
news:sj20639lenqciuj3ado65h013tt8e1femb@xxxxxxxxxx
Everything working

Help much appreciated

Thank you

Howard

On Thu, 31 May 2007 16:54:34 -0700, "'69 Camaro"
<ForwardZERO_SPAM.To.69Camaro@xxxxxxxxxxxxxxxxxxxxxx> wrote:

Hi, Howard.

I do not know how to get started on this.

Change the following line of code:

Dim rs As Recordset

To:

Dim rs As DAO.Recordset

The reason you're having the problem now and not before the conversion is
because the Access 2003 database developer took a shortcut and moved the
DAO
library above the ADO library in the precedence list, instead of
disambiguating the code by identifying which library's Recordset object is
being used. This is not guaranteed to stay in this configuation when the
database file is opened on multiple computers or is opened in different
versions of Access, so it's not a recommended method of fixing the
problem.
For more information on the co-existence of the DAO and ADO libraries,
please see Access MVP Tom Wickerath's article, "ADO and DAO Library
References in Access Databases," on the following Web page:

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

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.



.



Relevant Pages

  • Re: Possible DAO and ADO conflicts
    ... >> I have a legacy application which only has DAO references. ... >> I'm assuming that ADO would be able to create newer versions of Access ... > You can fool around with the order of the libraries in the reference list to ...
    (microsoft.public.vb.database)
  • Re: access 2003
    ... As you have code in your database that would only run using DAO, ... As you may know, if you have references to both ADO and DAO, then some ... object libraries both contain a Recordset object. ... The question is, if you have references to both ADO and DAO, which recordset ...
    (microsoft.public.access.conversion)
  • Re: Dim db As DATABASE
    ... By default, Access 2000 uses ADO. ... With any code module open, select Tools | References from the menu bar, ... Microsoft DAO 3.6 Object Library, ... Dim rsCurr As ADODB.Recordset) ...
    (microsoft.public.access.modulesdaovba)
  • Re: VBA Users & Groups
    ... I guess the main reason for the conversion is for the ... >ADO is a generic data access method, ... DAO is preferable in ... and some's in SQL Server) ...
    (microsoft.public.access.security)
  • Re: Member or Data Member not Found
    ... you've removed the reference to ADO. ... your declaration for tdf is incorrect. ... 2002 only references ADO, but you can add a reference to DAO. ... You must disambiguate as Dim rst As DAO.Recordset. ...
    (microsoft.public.access.formscoding)