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.
Microsoft Access

Avatar of undefined
Last Comment
PatHartman
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
Andy Brown
Flag of United Kingdom of Great Britain and Northern Ireland image

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.
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

Get the table definition of the current and then replicate for the new fields in another table.
Avatar of Andy Brown
Andy Brown
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

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

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
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
Avatar of PatHartman
PatHartman
Flag of United States of America image

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.
Avatar of Andy Brown
Andy Brown
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Thank you everyone for your comments.  Pat - that looks like it will do the trick nicely.
Avatar of PatHartman
PatHartman
Flag of United States of America image

You're welcome.
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo