Link to home
Create AccountLog in
Avatar of Andy Brown
Andy BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Copying fields from one linked table to another

I have an MS Access application and one of the functions is a comparison function where I compare the Master back-end structure to another back-end.  Currently, when it sees a discrepancy, it highlights the field and I add it manually.  

I was wondering if there was a way to copy the missing field (with everything, index, type, default value etc.) from the master back-end, to the destination back-end?  They are both linked to my front-end application.
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

>>I was wondering if there was a way to copy the missing field (with everything, index, type, default value etc.)
As far I know we don't have any method. We have to add columns manually using command/UI
Avatar of Andy Brown

ASKER

Hi Pawan - thanks for coming back to me,

Understood, and just to clarify.  I can easily add fields via VBA/SQL to linked back-end tables.  But it's the exact structure of the field that I want to try an replicate.
Get the table definition of the current and then replicate for the new fields in another table.
You are right, and I have done something like this in the past.  However, I was hoping to get a good/standard method for doing this.

Thanks again.
ASKER CERTIFIED SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
This may not be as cumbersome as you would think.

You can simply "Copy" the new field from one table, ...and "Paste" it into the target table...:
User generated imageUser generated imageUser generated image
*However*, ...this will not bring in the Data from this field.
A relatively simple way to do that, would be to highlight the entire (source table) field in *datasheet view*, then pasting it into the newly copied (empty) field in the target table.

I am sure someone could take the time to write something custom to do this (in using DAO or ADO), ...but no, ...there is no VBA "Method" for doing this.
The reason being that Access SQL is not exactly the same as other SQL "dialects"
Access fields can contain non-standard (Access only) attributes like: Text Align, validation text, IME Mode, hyperlinks, Multivalued fields, Attachment fields, ...etc

It might be simpler, for now, to copy/paste the field, ...then the copy/paste data...

Lets see what other Experts may post...
;-)


JeffCoachman
Jet and ACE support DDL even though the QBE only supports building DML.  DDL (Data Definition Language) is what we use to create, alter, and drop database objects.  DML (Data Manipulation Language) is what we use to query or modify data.
Thank you everyone for your comments.  Pat - that looks like it will do the trick nicely.
You're welcome.