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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying a Table

Status
Not open for further replies.

George1111

Programmer
Aug 6, 2003
25
AU
How do you copy a Table from from one Access Database to another Access Database? (Where the receiving database does not have a definition of the incoming table).

Thanks for any help.

 
Hi

DoCmd.CopyObject (see below for syntax), but do you realise you can also 'link' tables, save you copying and duplicationg data, unless you specifically want to.

The CopyObject method carries out the CopyObject action in Visual Basic. For more information on how the action and its arguments work, see the action topic.

Syntax

DoCmd.CopyObject [destinationdatabase][, newname][, sourceobjecttype, sourceobjectname]

The CopyObject method has the following arguments.

Argument Description
destinationdatabase A string expression that's the valid path and file name for the database you want to copy the object into. To select the current database, leave this argument blank.
If you execute Visual Basic code containing the CopyObject method in a library database and leave this argument blank, Microsoft Access copies the object into the library database.
newname A string expression that's the new name for the object you want to copy. To use the same name if you are copying into another database, leave this argument blank.
sourceobjecttype One of the following intrinsic constants:
acDefault (default)
acForm
acMacro
acModule
acQuery
acReport
acTable
sourceobjectname A string expression that's the valid name of an object of the type selected by the sourceobjecttype argument.
If you run Visual Basic code containing the CopyObject method in a library database, Microsoft Access looks for the object with this name first in the library database, then in the current database.

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
As a newbie I use the export (table, form, ets) and browse the path to the needed db.
 
I hadn't heard of the CopyObject method - thanks for that !
What I really want to do is copy the data from one table and insert it into a table in another database.
The reason I am doing this is because I changed the LENGTHS of some of the variables and I want to create a more compacted version of the table.
ie, The table field names remain the same - just the data field lengths in the destination table have been changed.

I value your input.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top