Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 2002
    Posts
    44

    Unanswered: ADO vs. DAO in MS Access 2000

    I am a long-time programmer, but a newcomer to Access/VB/VBA programming.

    I have been reviewing some texts and tutorials that I have found online as well as reading code examples in the VB Help files. Some of the tutorials I have found are a couple of years old and are for Access97. I have found several references in these tutorials and VB Help files which reference objects based on the DAO object model. Because of some conflicting object types in the DAO and ADO object models (the Recordset Object for example) some of the code examples either do not work, or require specification of DAO vs ADO to make them work.

    My question is, what is the real difference in these two? I am sure one each has advantages and disadvantages over the other, but I'm not sure what they are.

    Should I be using DAO some times and ADO other times?

    Can someone concisely explain (or point me to a link that does so) the differences in the two object models?

    Is one really substantially better than the other, or is this kind of like the argument between using different shells or editors in the Unix world?

    Since I am just starting my Access db programming experiences, I would like to start off on the right foot, the right way, using and learning the proper object model.

    Thank you for your help.

  2. #2
    Join Date
    Nov 2001
    Posts
    336
    It's a big topic

    Article below gives you answers on some of your questions:

    Migrating from DAO to ADO
    http://msdn.microsoft.com/library/de...oadoupdate.asp

    HTH, Igor

  3. #3
    Join Date
    Apr 2002
    Location
    Lousivlle
    Posts
    2
    MSDN features a book excerpt that describes both the DAO and ADO object models. The URL is http://msdn.microsoft.com/library/de...l/acchap2.asp.

    I am the author of the excerpted book, and my personal preference is for ADO although DAO has some advantages in a few cases. You can learn more about ADO at my site, www.programmingmsaccess.com.

    I hope this reply helps.

  4. #4
    Join Date
    Nov 2001
    Posts
    336
    Thank you for posting these excellent links.
    The first one doesn't work for me though.

  5. #5
    Join Date
    Apr 2002
    Location
    Lousivlle
    Posts
    2
    Originally posted by IGelin
    Thank you for posting these excellent links.
    The first one doesn't work for me though.
    The dbforums software abbreviated the link. Let's try again. The following link spreads over two lines; paste both parts into your browser.

    http://msdn.microsoft.com/library/de...ml/acchap2.asp

  6. #6
    Join Date
    Apr 2002
    Posts
    44
    Thank you for the responses...I have spent much of the night searching for related topics, and now after reading your chapter, I feel like I understand the implications of both.

    The solution I am developing is going to be strictly for Access 2000/Jet, so I think I will go with DAO on this one...

    It also seems like there are more online examples using DAO instead of ADO.

    I am currently in the military and deployed to the middle of the desert while I am working on this. Consequently, there are no bookstores, and I have no books on programming Access so all of my near-term learning is going to have to come from finding informational links online and asking some questions in this forum.

    Please be patient when I ask "obvious" or stupid questions as I do not have any reference material to use other than Access Help files.

    Let me ask a couple of these stupid questions right now if you don't mind.

    1. I have discovered to use the DAO object model, I have to go into the "References" menu area and check the box for Microsoft DAO 3.6.
    Once the database is developed and I send it to other people, are they going to have to turn on that reference in *their* copy of Access as well, or is that setting saved in the actual database file? If I have to teach users how to turn on this setting, it will definitely not be worth developing in.

    2. okay, now for stupid question number 2. I have seen in some code examples, people using the '_' character as part of a parameter. For instance
    Code:
     db.OpenRecordset( _ "SELECT TestText FROM tblTest " & _ "WHERE
    TestNum = " & Me!txtOne)
    what does the underscore mean or do?

    Lastly, it looks like to do any "real" Access programming, I am going to have to be writing several SQL statements, and not just generating queries using the "queries" in Access. Can someone point me to a good web link that references the different SQL commands and what they do?

    Thank you for your assistance

  7. #7
    Join Date
    Apr 2002
    Location
    Germany
    Posts
    228
    1. No, they don't. But they'll need the correct libraries installed of course as well (in the case of DAO 3.6 it's installed with access).

    2. the underscore _ character is used to break a single line of code into multiple lines. VB/VBA uses the newline as control character. By using the _ you tell it the statement will continue in the next line. Your code shown should actually look like:
    Code:
    db.OpenRecordset( _ 
        "SELECT TestText FROM tblTest " & _ 
        "WHERE TestNum = " & Me!txtOne)
    the tab on the second and third line is not mandatory but I practise it for better readability.

    3. A quick search on Jet SQL syntax gave me this: http://www.aspin.com/home/references...ase/sql/jetsql

  8. #8
    Join Date
    Apr 2002
    Posts
    44
    Thank you everyone for your assistance. This has been a most helpful experience.

    Apel, that link is PERFECT for what I need.

  9. #9
    Join Date
    Nov 2001
    Posts
    336
    Thanks Rick.

Posting Permissions

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