Results 1 to 2 of 2
  1. #1

    database object missing from variable type list

    Access 2000 - When I define a database in Access 97 VBA, I type Dim dbs as Database. Just like it says in the help files and in the reference books. It works just like it is supposed to. When I do the same in Access 2000, I get the error message "User defined type not defined". And sure enough the object "database" is not in the variable/object type list that pops up to offer choices - and it is no longer listed in the object browser. What gives..??

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: database object missing from variable type list

    You need to read the reference books and help files for Access 2000![img]/w3timages/icons/crazy.gif[/img] Access 2000 uses ADO as its default object model, not DAO as in previous versions; and ADO has no database object. If you want to keep writing DAO code, you need to do two things: 1) set a reference to the DAO 3.6 object library, and 2) make a habit of specifying your object model when you declare object variables. So you declare a database object as DAO.Database and a recordset object as DAO.recordset, etc. This is especially important if you want to use both DAO and ADO, since there are objects like recordsets, properties, fields, and others, that exist in both models. An unspecified declaration will compile but most likely not run.

Posting Permissions

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