Results 1 to 6 of 6
  1. #1
    DaveShmave
    Guest

    Access 97 to 2K Conversion-- Question 1 of 10,000!

    I have just started looking at a 97 database that has been converted to 2K. I noticed one of the References said 'Microsoft DAO 3.6 Object Library'.

    This may seem like a stupid question, but why if I remove the DAO object library listed above does my code no longer work, specifically 'Dim db As CurrentDb'?

    I noticed on new Access 2K databases the DAO object library and one other VBA related object library (found in the converted database) are missing.

    So assuming I wanted to start from scratch, how would I code the line 'Dim db As CurrentDb' in a new Access database, not one that's been converted?

    Thanks,

    Dave

    I'm only joking about the 10,000 questions. It will just seem like it to me.

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

    Re: Access 97 to 2K Conversion-- Question 1 of 10,000!

    Access 2000 defaults to ADO as its object model and CurrentDb is DAO. If you want to keep writing the code you're familiar with, you'll need to set the DAO 3.6 object reference manually. However, I'd suggest you also leave the ADO reference set and specify your object model in your code, as in DAO.Database or ADODB.Recordset. If you can get over the learning curve, ADO offers a lot of things not available in DAO, but they each offer something the other lacks.

    The other library was probably either a compatibility library or one of the VBA extensibility libraries, and you shouldn't need it for new code unless you want to specifically reference methods and properties that are only available through that library.
    Charlotte

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Access 97 to 2K Conversion-- Question 1 of 10,000!

    Dear Dave,

    I had a similar problem with a recent conversion and Charlotte advised the following:

    See <A target="_blank" HREF=http://www.wopr.com/cgi-bin/w3t/showflat.pl?Cat=&Board=acc&Number=11690&page=1&vie w=collapsed&sb=3>post</A>
    Re: Type mismatch (Error 13) [Post#: 11724 / re: 11690 ]


    The way I understand it is that Access 2000 now supports both ADO and DAO, this causes some confusion so you have to add DAO to the beginning of your recently converted code, something like this::

    Dim dbs As DAO.Database
    Dim rst As DAO.Recordset

    You also need the Reference DAO 3.6 Object Library ticked as well.

    Rupert

  4. #4
    DaveShmave
    Guest

    Access 97 to 2K Conversion-- Question 2 of 10,000!

    Thank you Rupert and Charlotte.

    I will begin looking into ADO now. Are there any books you can recommend to hopefully shorten my learning curve? Or is the online help actually helpful?

    Is Microsoft fazing out DAO all together? Seems to me I read that somewhere but I'm not sure.

    Also, how would I go about specifying the CurrentDb (which as you stated is DAO specific) in Access 2000 using ADO? Would that be the 'Dim db as DAO.CurrentDb' that Rupert offered?

    Thanks again,

    Dave[img]/w3timages/icons/hairy.gif[/img]

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

    Re: Access 97 to 2K Conversion-- Question 2 of 10,000!

    It won't do you any good to try because ADO doesn't have a database object. The closest equivalent is CurrentData, which is somewhat analagous to CurrentDb, but it returns a generic Object pointer rather than a database.

    I believe that Microsoft isn't planning any future enhancements to DAO, but they'll continue to support it for a while at least. After all, they're still supporting CDO, which was a previous try at coming up with a new object model.

    As for a reference, try <A target="_blank" HREF=http://www5.bestwebbuys.com/books/search?t=ISBN&q=0-7821-2556-5> Visual Basic Developer's Guide to ADO </A>, which is one of the few ADO books that specifically targets VB/VBA rather than C++ or Java. The on-line help can be useful if you know how to find what you need. Unfortunately, just hitting F1 on an ADO keyword will often get you nothing but a gray help screen with nothing at all on it.
    Charlotte

  6. #6
    DaveShmave
    Guest

    Re: Access 97 to 2K Conversion-- Question 2 of 10,000!

    Thanks Charlotte! [img]/w3timages/icons/wink.gif[/img]

    I'll look into the book you listed above.

    If and when I have more questions on the subject I'll repost.

    Thanks again,

    Dave

Posting Permissions

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