"The code is exactly
how I would like to write code and the algorithms used are very
efficient and well-documented."
Van T. Dinh, Microsoft MVP
|
|
|
Category:
|
Database : Access/Jet
|
|
Description:
|
Microsoft Access Jet databases and their objects (MDB and ACCDB database formats)
|
Module: modTableCopyDAO
Copy table structures (including complex fields) between tables using DAO
|
Procedure Name
|
Type
|
Description
|
|
(Declarations)
|
Declarations
|
Declarations and private variables for the modTableCopyDAO module
|
|
AddFieldToTable
|
Procedure
|
Adds a field to a table in any Jet database by creating the field object, setting its properties, and appending it to the Fields collection of the specified table.
|
|
ChangeFieldType
|
Procedure
|
Changes the data type of the named table field/
DAO does not allow you to programmatically change the data type of a field once it exists in a table. To get around this limitation, this procedure uses SQL Data Manipulation Language (DML) queries to create a new temporary field with the specified new data type, copies the data from the original field to the new field, deletes the original field, and renames the new temporary field to the original fields name.
|
|
CopyIndexes
|
Procedure
|
Copy the index definitions from an existing table to a new one
|
|
CopyLinkedTable
|
Procedure
|
Copies a linked table from one database to another database. This copies the link rather than the actual data.
|
|
CopyRelationsAll
|
Procedure
|
Copies all relations from one database to another (tables must already exist in the destination database)
|
|
CopyRelationsOne
|
Procedure
|
Copies all teh relations for one table from one database to another (tables must already exist in the destination database)
|
|
CopyTableFields
|
Procedure
|
Copy the field definitions from an existing table to a new one
|
|
CopyTableProperties
|
Procedure
|
Copy the table properties from an existing table to a new one
|
|
CopyTableStructure
|
Procedure
|
Copies the structure of a table to a new table, including all properties and indexes.
If the named table already exists in the destination database, this function will not copy the table and returns a value of False.
If running in Access, the DoCmd.TransferDatabase command should be used instead.
Special Note:
--------------
DAO does not allow the creation of certain Access-defined field properites. These include ColumnWidth, ColumnOrder and ColumnHidden.
Therefore, this routine may not recreate all the existing property settings in the destination table.
After using this function, be sure to check the resulting table for accuracy and any needed manual changes.
|
Overview of Total Visual SourceBook
The source code in Total Visual
SourceBook includes modules and classes for Microsoft Access, Visual
Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily
add this professionally written, tested, and documented royalty-free code
into your applications to simplify your application development efforts.
Additional Resources
|
|