Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I copy an Access table with its column props & constraints?

Status
Not open for further replies.

Lexxxa

Programmer
Jan 27, 2012
4
GB
Hi,

I am trying to do something that I thought would be very easy (and I have done very easily before using other RDBMS like MySQL) but it appears because of some limitations of the JET engine is proving to be anything but easy when using an Access database.

In my application's Access database there are lots of 'template' tables - they have a pre-defined structure and constraints but contain no records.

What I need to do is at the appropriate time copy one of these template tables and insert it into the database under a new name with all the column properties and constraints of the template table. I have no idea in advance the order in which the tables are to be created from the templates or indeed which tables will need to be created when the application is run.

I have posted this in the C# section of this forum but then thought maybe I was asking the wrong people and the JET experts may be more able to help.

Many thanks in advance.

--Axel
 
Have a look at the DoCmd.TransferDatabase method.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hello PHV,

thanks for your reply. I had a look at this and this DoCmd appears to be a VBA object. Do you know how to do the same using ADO.NET's data providers for MS Access - either OLE DB or ODBC?

Many Thanks again

--Axel
 
Have you tried to use an ADOX.Catalog object ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Yes, that's how I did it previously using ADOX.Catalog but I want to get rid of all the "legacy" ADO classic code.
I'm finding it hard to understand how or why the ADO.NET provider seems to have lost some of the functionality of its predecessor?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top