Courses - Microsoft
Access 322 very strongly recommended|
ADO, CursorType, Connection, Student Test Taker, DMIN, NZ, SQL Server Connect
This course is valid for Access 2000 through 2003.
If you are using Access 2007 or 2010, you will still benefit from this course.
You will find that the concepts are the same, but there are cosmetic differences between the versions.
Order before 1/20/2017 to
get a FREE upgrade to our
Access 2010 version!
Click here for details
In today's class, we're going to learn about
ADO (ActiveX Data Objects) which is a different way of working with
recordsets - ADO is slightly different from DAO, and it has its
own uses. We'll talk about those uses in today's class.
We're also going to build a sample project, a Student Test Taker,
where we'll do lots more with recordsets, and we'll learn lots of new
techniques and functions.
We'll start by going over the available
References, and you'll see how to enable ADO (ActiveX Data Objects).
You'll learn how to create an ADO connection,
set the CursorType, LockType, and lots more.
We'll go over a lot of the same concepts as DAO
recordsets, such as looping through records, adding, editing, and
deleting records (and so on). You'll see how both are similar, but each
has its own pros and cons. One of the major benefits of ADO is that you
can connect to an SQL Server or Oracle Database with it:
Next we'll use our Recordset skills for a little
project: we'll build a student test taker (quiz) program. We'll
start out with a form/subform for the teacher to input questions and
Then we'll build a form where a user has to
log on and then take the test. All of his answers will be logged in
the database using a Recordset.
Then we'll build a nice report to summarize each
Access 323 - Course Outline
1. ADO ActiveX Data Objects, Part 1
Benefits of ADO v. DAO
Create a Database Connection
2. ADO ActiveX Data Objects, Part 2
Loop Through Records (EOF)
Default is a READ ONLY Lock Type
AddNew to Add a New Record
Delete to Delete a Record
ADO Connection Strings
Connect to SQL Server
Connect to Oracle
Using Both ADO and DAO Together
3. Student Test Taker, Part 1
Teacher Q/A Form
4. Student Test Taker, Part 2
Test Taker Form
Student Combo Box
Question Text Box
Answer List Box
Take Test Button
Disable the Student Combo
Disable the Test Button
Check to Make Sure Student Picked
Auto DropDown the Student Combo
DMin Function to Find Next QuestionID
Nz Function To Return Zero on Null
5. Student Test Taker, Part 3
Load List Box with Answers
RecordSet for Answers
Button to Save Results
Save With RecordSet to ResponseT
Move To Next Question
Lock the Next Button When Test Done
6. Student Test Taker, Part 4
Query To Show All Student Answers
Different Links Give Different Results
How Multiple Relationships Interact
Report Grouped By Student
Grouping Options Button in Wizard
Summary Options Button
Calculate Student Average
Count of Records
Hiding the Detail Section
Microsoft Access 323
Richard on 1/1/2008:
ADO ActiveX Data Objects, Student Test Taker|
BRYAN binkerd on 5/22/2009: time 5:53|
set the vb code up and get an error when I put Dim Con As New Connnection I get a compile error stating invalid use of keyword.
Richard Rost on 5/22/2009: Bryan, what version of Access? Did you make sure you have the Reference set up?|
bryan binkerd on 5/22/2009: Running access 2003|
Dao 3.6 object library
ADO 2.8 2.8 library
ADO Recordset2.8 Library
along with the standard selected references
Richard Rost on 5/26/2009: Bryan, I just set it up and tested it again on two machines and it worked fine for me. Without looking at your computer I can't tell what the problem is. Make sure the DAO reference has a higher priority than the ADO one. Try it in a different (blank) database? Maybe there's something corrupt in that one.|
bryan binkerd on 6/5/2009: OK Rick, Got it going. Head space and timing error on my part|
email@example.com on 6/27/2010: Dear Richard;|
I do thank you for the efforts you put in Access seminars and I found it very helpful and informative but frankly I'm a little bit confused when listening to your Access seminar 320 for you mentioned that DAO is GOOD and ADO is BAD (lesson 1. Recordset Basic, in frame time 13:12) whereas I've read a book titled ACCESS 2007 FOR DUMMIES (Chapter 5: Using SQL and Recordsets, section Recordsets and Object Model page 665) saying the contrary, below is the quote from the book:
"Because Access offers two different object models for the purpose of working with recordsets, you may find recordsets confusing. One is DAO (Data Access Objects); the other is ADO (ActiveX Data Objects). The DAO model is the older of the two. DAO works only with Access tables. ADO, the newer of the two, works either with Access tables or external data sources, such as Oracle and Microsoft SQL Server.
At first glance you may think, “Well, I’ll never use external data sources, so I’ll stick with the DAO object model.” Picking an object model, though, isn’t that easy. The newer ADO model is currently favored by Microsoft, meaning that ADO will continue to grow and get better while DAO remains in maintenance mode, which generally spells doom for a technology. If a technology is in maintenance mode today that pretty much guarantees that it won’t exist at all in the not-too-distant future.
Given the bias of Microsoft, we stick with ADO in this book."
For me, I understand that DAO is used for Access only and ADO is more generic as you mentioned in Access 323 but I need to hear your opinion in this issue, which one is the best DAO or ADO take into consideration Access 2007 and 2010?
Reply from Richard Rost:
I go into much more detail in my seminars and lessons, but basically DAO is a model that is more specific to Access and gives you more control over Access - including design of the tables. ADO is more generic, applies to other database types, and can be used in online databases (like I show in my ASP classes). Both are just fine for basic use. I actually mix and match between them a lot. Microsoft is actually focusing on DAO for the future even though it is the older of the two standards. I personally say it can't hurt to learn them BOTH.
Lilly Nguyen on 10/13/2010: Hi,|
I would like to download Access Student Data files. What is the password?? thanks
Reply from Richard Rost:
The databases were all moved here: http://www.599cd.com/access/StudentDatabases/.
The passwords for the advanced databases are the same as your installation password for the course. See that page for more info.
Kenny Nelson on 12/8/2015: We use SQL Server for our file handling so I use the ADO model in Access. Is it OK to use ADO to handle our true Access tables also? Are there any ill effects from using ADO over DAO for this?|
Reply from Alex Hedley:
It's more person preference, there are benefits for an against.
You may want to read these articles from the 599CD News: