ADO examples for a beginner

thesavo

Registered User.
Local time
Today, 13:19
Joined
Jun 23, 2011
Messages
10
Hello, I am still green when it comes to using MS access.
I am attempting to better my-self by using a recordset object instead of using DLookups. My plan is to use these for reading and manipulating data in MS access 2007.

From a lot of the reading I have done, I cannot tell whether to use ADO or DAO?

My access DB is used to store User account info for some of the systems we manage in our office. This will be used by only a few admins to maintain user information

I am having a rather hard time finding hard-and-fast examples or "best practices" that maintain any kind of .consistency. Also, any kind of documentation requires laborious reading of Why to use, and theory of use, before any kind of...

This is what to use.... kind of articles.

I anticipate that these tools will forever live in MS access, since that is all I have at my disposal at this office. In the future I would like to make data-connection strings more open to tools other than MS Access, like SQLite....

However MS Access is what I am driven to. I have been using DLookups to get data from a table, but that is starting to feel juvenile, and not good for retrieving more than 1 column of data from 1 particular row.

Can anyone directly I to some kind of idiots guide to ADO or DAO. I am not a programmer by trade, and would like to get some coding done soon. Everything in this office is To Be done: yesterday. I don't have the time to read long diatribes as to why one is better than the other.
 
Can anyone directly I to some kind of idiots guide to ADO or DAO.

I am using both types of objects in the Access 2007 / SQL Server 2008 R2 technology application I am working on.

I prefer to work with ADO objects.

The one reason I need to use DAO objects is to download records (from SQL Server using a Pass-Through query) into an Access FE Temp Table. Since Access Tables are DAO objects (as are QueryDef objects too) you must use DAO objects to automate use of those types of objects.

Sample threads I would suggest you take a look at:

Example of SQL INSERT / UPDATE using ADODB.Command and ADODB.Parameters objects
http://www.access-programmers.co.uk/forums/showthread.php?t=219149

Example of DAO.QueryDef objects downloading records from a SQL BE DB via Pass-Through query and populating a FE temp table with them
http://www.access-programmers.co.uk/forums/showthread.php?p=1119605&posted=1#post1119605
 
Last edited:
You should work with both. The DAO is slightly faster to write and I use them when there is no reason to use ADO especially when the data is held in linked tables within the current database.

However once an ADO connection is established there is little difference in writing effort between the two and it is very easy to use the connection for sending commands as well as retrieving recordsets.

ADO is my preference for working with tables in other Access databases or SQL Server. I use ADO exclusively when writing VB.NET applications.

One of ADO's big advantages is the ability to produce disconnected and stand alone recordsets. The stand alone recordset can be constructed independently of any table by simply instantiating a recordset without a connection and adding records. They can then be used as the recordset for forms, listboxes and combos.

ADO recordsets are often a superior alternative to temporary tables. They can even be saved as xml files and reloaded as required.

ADO is superior when working with large numbers of users since the recordset can be disconnected, removing the connection load on the server. They are used for connections from web interfaces written in ASP.
 

Users who are viewing this thread

Back
Top Bottom