copy SQLserver tables into .mdb (not linked)

P

pteranodon

I work with a SQLserver database through an ADP and also through ODBC
linked tables in an MDB.

My goal is to create a stand-alone .mdb that has a snapshot of the
data in all user tables. To do this, I create a new mdb file. From
within this mdb I

- File->Get External Data->Import...
- point to my .ADP
- Select all tables
- OK

This leaves me with an MDB with stand-alone versions of the SQL
server's tables (minus their indexes) that I can query and safely play
around with.

How could I go through these steps in code? I see that I could use
DoCmd.TransferDatabase, but I would need to repeat it for each table
in the database and I don't know how to get a list of tables from an
external ADP or a SQL server database. (I'm used to doing this with
DAO.Tabledefs or MSysObjects queries, but I'm new to ADODB).

For bonus points, how do I import (or recreate) the indexes that exist
on the source tables?

Thanks for any pointers, sample code, or air code!

Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top