[AccessD] Using ADO to change a TableDef? Mixing ADO and DAO?

jwcolby jwcolby at colbyconsulting.com
Fri Apr 22 09:09:05 CDT 2011


DAO is the object model for the the Access database object.  DAO knows about things like *Microsoft 
ACCESS* databases, tables, fields, properties, queries, forms, reports and so forth.  IOW *anything* 
that is an object in Access is manipulated using DAO.  You can modify the tabledef object with DAO I 
believe.  DAO knows nothing about *anything* other than objects inside of an Access database container.

ADO is an object model for manipulating very specific objects related to *data* and will work with 
any data store which has an ADO provider - which includes SQL Server, Access, MySQL, etc.  It knows 
about the command object, datasets, tables, columns, relationships and the like.

It is possible to change a table with SQL.  There are keywords for adding and dropping columns, the 
data type for the column, adding indexes and the like.  You can execute SQL using the ADO command 
object.  That is different from doing so directly with ADO.

John W. Colby
www.ColbyConsulting.com

On 4/22/2011 9:48 AM, jm.hwsn wrote:
> Brad,
> I'm with you. Although after ten years working with Access, I still get
> confused between ADO and DAO.
> As a matter of preference, maybe because I don't understand the issues, I
> routinely use DAO anytime I need to create a TableDef or anything else that
> needs to connect to a database, etc.
>
> Maybe someone on this list can give us definitions of the two and give
> examples where one is better than the other.
>
> Jim
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Brad Marks
> Sent: Friday, April 22, 2011 8:31 AM
> To: Access Developers discussion and problem solving
> Subject: [AccessD] Using ADO to change a TableDef? Mixing ADO and DAO?
>
> All,
>
> We have an existing Access 2007 application that uses ADO.
>
> We now want to enhance this application to be able to change a TableDef
> with VBA code so that we can change the path to an Excel file on the
> fly.
>
> Is it possible to change TableDefs with ADO?
>
> I have seen many examples of how to change TableDefs with DAO, but I
> have not yet discovered an example of how to do this with ADO.
>
> I am fairly new to the world of Access and I am still trying to wrap my
> little brain around the "ADO vs DAO" debate.
>
> Is it Okay to mix both ADO and DAO in a single Access 2007 application?
>
> Thanks,
> Brad
>



More information about the AccessD mailing list