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 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
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?
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: