Copying table structures in code 
Author Message
 Copying table structures in code

: In Access 97 I get another attached table pointing to the same
: "real" table as the original attached table.  
:......................

Just to confirm out suspicions I discovered a KnowledgeBase article
which you may also want to look at.

ACC97: Copying Linked Table Does Not Create Local Table

Point your web browser to:
http://www.*-*-*.com/

-- Chris Bell --



Sun, 12 Dec 1999 03:00:00 GMT  
 Copying table structures in code

: We are converting from Access2.0 to Access97 and I have run into a
: problem with some code.
: I have a sub that used the "CopyObject" method and it worked well
: enough in version 2.  The source was an attached table and the
: destination was a local table with a temp name.  The method would
: read the structure and data from the attached table and create a
: local (non-attached) table identical to the original.  It was then a
: simple matter to run an SQL to strip the data out if I didn't want.
: In Access 97 I get another attached table pointing to the same
: "real" table as the original attached table.  
:..............................

Looks like there is a change of behaviour here.

The online help states that the CopyObject has the same effect as
using Copy and Paste. This seems true enough ... but in V2 as you say
both methods created a local copy and now in 97 (not sure about 95)
both methods create a duplicate link.

The work-around to emulate the CopyObject would be to execute a simple
MakeTable query. It could either be a saved query (executed via code
or macro) or dynamic SQL generated in code to suit.

Something like :

Dim strSQL as string
strSQL = "SELECT tblOne.* INTO temp FROM tblOne;"
Currentdb.execute strSQL

-- Chris Bell --



Sun, 12 Dec 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Copying table structure w/ code

2. HowTo Copy a Recordset from a Table to an identically structured table

3. Copying the structure of a table to a new table

4. Copying the structure of one Access table to a new Access table

5. copy table structure

6. Newbie: How to copy Table structure?

7. Copy Foxpro 2.6 table structure

8. Creating .MDB in ADO; copying a table structure

9. How to copy structure of a table to another database

10. Copying Table structures

11. Newbie: How to copy Table structure?

12. Q. How do I copy a table structure

 

 
Powered by phpBB® Forum Software