Copy a linked table, including descriptions

  • Thread starter Thread starter Andrew Gabb
  • Start date Start date
A

Andrew Gabb

I want to copy a linked table (the link itself not the data) from one DB
to another, and include the field Description text. When I do this
normally (eg cut/paste, import, export), the field descriptions disappear.

Manual is good, but VBA is OK too.

I'm using Access XP, but if necessary I can use a later version to do
the copy.

Andrew
 
Andrew said:
I want to copy a linked table (the link itself not the data) from one DB
to another, and include the field Description text. When I do this
normally (eg cut/paste, import, export), the field descriptions disappear.

Manual is good, but VBA is OK too.

I'm using Access XP, but if necessary I can use a later version to do
the copy.

I found one klunky way to do it, but I'd rather a better way.

# Copy the table link to the new DB.

# Open new table link in Design view and delete all except the key
field(s).

# Open old table link in Design view and copy all fields.

# Paste the fields into the new table and save. Ignore the nag.

Andrew
 
Well, given that the default functionality doesn't completely copy, I
suppose we could do it programmmically via VBA.

Pseudo-code:

Dim t As DAO.TableDef
Dim p As DAO.Property

With CurrentDb.TableDefs("SourceTableName")
For Each p in .Properties
t.Properties.Append p
Next
End With

Read the VBA help for correct syntax on appending/modifying a new
property to the Properties collection. You may need logic in place to
add a property if one doesn't exist already. Of course, you also need
CreateTableDef method before going in the loop to create the new table
first.

Hope that gets you someplace.
 
Back
Top