Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Jun 2001
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    AccessXp Database Object (AccessXP)

    I have an Access97 database who's information I was finally able to import into a new AccessXP file. The original file was created by an outside consultant, who of course is now nowhere to be found. It has a switchboard and is full of macros, procedures, codes, etc. When I open it in XP the message "Compile error; user defined type not defined" displays and the following line of code is highlighted: "Dim dbs as Database". It seems improbable to me at least, but after digging around in Help I can find no reference to a Database object in XP, although there is information about it in 97. Perhaps that object has been replaced by another, has a new name? I don't know, but any help would be greatly appreciated. Thank you.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: AccessXp Database Object (AccessXP)

    Activate the Visual Basic Editor (Alt+F11).
    Select Tools | References...
    Locate and tick "Microsoft DAO 3.6 Object Library"
    Click OK.
    Open any module.
    Use Edit | Replace... to replace all occurrences in the Current Project (not just the Current Module):

    <table border=1><td>Replace this...</td><td>...by this</td><td>As Recordset</td><td>As DAO.Recordset</td><td>As Field</td><td>As DAO.Field</td><td>As Property</td><td>As DAO.Property</td></table>
    DAO (Data Access Objects) was the default data object model in Access 97 and before; ADO (ActiveX Data Objects) is the default data object model in Access 2000 and later. DAO is still available, but there is no reference to it by default. The replacements above are meant to avoid confusion with ADO objects of the same name.

  3. #3
    Star Lounger
    Join Date
    Jun 2001
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AccessXp Database Object (AccessXP)

    Thanks for the reply, but what should replace: As Database?

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: AccessXp Database Object (AccessXP)

    DAO.Database
    Charlotte

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: AccessXp Database Object (AccessXP)

    Charlotte already replied.

    In itself, setting a reference to the DAO library should be enough to let Database be recognized as a valid object type. And there is no chance of confusion, for Database is not an ADO object. But it is neater to prefix *all* DAO objects; I always do that in my code. So by all means, follow Charlottes recommendation.

  6. #6
    Star Lounger
    Join Date
    Jun 2001
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AccessXp Database Object (AccessXP)

    Wala. Once I found and updated all the references that problem was solved. Now on to the next. Thanks for your help!!!!!!!!!!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •