Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Seattle, Washington, USA
    Posts
    179
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Setting an object as a database

    I'm trying to run a NotInList event that would allow the user to add an item that isn't in the list.

    There is a line that is giving me the fits:

    Dim dbsInventory As Database

    When I type "Dim dbsInventory As" there is an object browser window that "pops up" and it doesn't list Database as an option.

    Why?

  2. #2
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    NYC,USA,Earth
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting an object as a database

    What version of Access are you using?

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Seattle, Washington, USA
    Posts
    179
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting an object as a database

    I'm using Access 2000

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

    Re: Setting an object as a database

    Database is a DAO object. If you don't have a DAO reference set, you won't see it or be able to use it.

    If you do set the DAO reference, you should also start specifying the object model in your declarations to avoid confusing Access/Jet about which model the object belongs to. So dim dbs as DAO.Database, dim rst as DAO.Recordset, etc., keeps Access from losing its mind. There are objects that have the same name between the two models (like Recordset, Field, Parameter, Property) that are very different and have different methods and properties between the two object models. If you don't specify, the code may compile but it is likely to break at runtime.

    There are also very different objects between the models (i.e., DAO has querydefs but ADO has query objects), so specifying helps you as a programmer remember what you were doing and keeps you from mixing the two models in the same routine, an action that is likely to get you a quick trip back to the Windows desktop without even an error message in between.
    Charlotte

  5. #5
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    NYC,USA,Earth
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting an object as a database

    I am familiar with the DAO object model but am feeling more and more out of touch because of my lack of knowledge and experience with the DAO object model. Forgive me if this has been asked before but could you recommend a path for someone who needs to catch up? TIA

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

    Re: Setting an object as a database

    There are a bunch of books on ADO, but virtually none on ADO in Access. The Access 2000 Developer's Handbook (Vol 1esktop Edition) devotes over 130 pages to nothing but ADO with Access, plus most of the examples in both volumes use ADO code, but I haven't found a book that goes further than that.

    However, if you're at all familiar with VB, a couple of good ADO books are William Vaughn's "ADO Examples and Best Practices" and Mike Gunderloy's "The Visual Basic Developer's Guide to ADO". I like Mike's book better for the way it handles some of the more exotic ADO concepts like Shaped recordsets, but both of them are worth having. Most of the code can be pasted into Access and work just fine, but of course samples are all in VB6.
    Charlotte

  7. #7
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    NYC,USA,Earth
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting an object as a database

    Thanks a lot for your recommendations, Charlotte. I'll look them up on my next trip to the bookstore!

Posting Permissions

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