Create a table similar to the table in another mdb with all data

  • Thread starter Thread starter Devesh Tyagi
  • Start date Start date
D

Devesh Tyagi

Hello All,
I need to create a table similar to the table in another mdb with all its
data using odbc. Is their any way to do this ?
 
One approach might be to link to that table from within the "other" mdb,
then use copy/paste to generate a 'local' copy.

Are you sure you need a separate copy? Would it be sufficient to merely be
able to link to the existing table?

--

Regards

Jeff Boyce
Microsoft Access MVP

Disclaimer: This author may have received products and services mentioned in
this post. Mention and/or description of a product or service herein does
not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
If you really need another copy of the table (and not link to the table),
then copy/past from a link won't work.

Copy/pasting a linked table only produced another linked table. You can use
a make table query to do this, but then you will need to add any indexes /
primary key to the table after it is created.
 
Devesh Tyagi said:
Hello All,
I need to create a table similar to the table in another mdb with all its
data using odbc. Is their any way to do this ?

You say 'using odbc', but if that isn't important then TransferDatabase will
do the job for you:

DoCmd.TransferDatabase acExport, "Microsoft Access", "C:\Temp\MyDb.mdb", _
acTable, "LocalTableName", "NewTableName", False

Set the last argument to True if you want to copy only the table structure.

This example will copy the table "LocalTableName" to the database
"C:\Temp\MyDb.mdb", naming it "NewTableName". You can keep it the same name
if you wish.
 
Thanks, Daryl... I can never keep that straight!

On the other hand, if the OP imported the other table, he'd have a copy he
could modify as needed.

--

Regards

Jeff Boyce
Microsoft Access MVP

Disclaimer: This author may have received products and services mentioned in
this post. Mention and/or description of a product or service herein does
not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
Back
Top