My Assistant
![]() ![]() |
|
|
Aug 27 2007, 08:38 PM
Post
#1
|
|
|
New Member Posts: 2 |
I have many excel spreadsheets that have the same data structure. I edit these often, so they brought into Access as linked tables. To normalize my dataset, I need to combine these tables, plus add a column that indicates the name of the linked table from which the particular row of data is drawn. Where each source table has the same five columns A through E, I seek to create a combined dataset that has columns A, B, C, D, E and SourceTableName.
***I'd prefer not to use an append query since the source spreadsheets will be modified frequently and I don't want to have to recreate the non-dynamic table every time data is revised.*** Is there a method that serves to combine and add the source table name, without loosing the ability for changes in the spreadsheets to flow through when I update the links? |
|
|
|
Aug 27 2007, 09:29 PM
Post
#2
|
|
|
UtterAccess VIP Posts: 3,645 From: Near Toronto, ON, CA |
Perhaps a Union Query?
for instance: Select "Alpha" as SheetSource, NameField, ID, Amount from LinkedSheet1 Union Select "Beta" as SheetSource, NameField, ID, Amount from LinkedSheet2 Union Select "Gamma" as SheetSource, NameField, ID, Amount from LinkedSheet3 |
|
|
|
Aug 27 2007, 09:46 PM
Post
#3
|
|
|
UtterAccess VIP Posts: 3,071 From: The Land of the Access Ninja's |
Welcome to UA!!
You will need to use a UNION query here but to get the SourceTable name you will have to change things a bit. Pay particular attention to the part in blue. CODE SELECT A, B, C, D, E, [color="blue"] 'LinkTableName1' As SourceTableName [/color] FROM LinkTableName1 UNION ALL SELECT A, B, C, D, E, [color="blue"] 'LinkTableName2' As SourceTableName [/color] FROM LinkTableName2 Dane |
|
|
|
Aug 27 2007, 09:47 PM
Post
#4
|
|
|
UtterAccess VIP Posts: 3,071 From: The Land of the Access Ninja's |
Oops, I had the window open and did not realize that you responded Steve!
Dane |
|
|
|
Aug 28 2007, 06:25 AM
Post
#5
|
|
|
UtterAccess VIP Posts: 3,645 From: Near Toronto, ON, CA |
No worries- hopefully between the two he can solve his problem!
|
|
|
|
Aug 28 2007, 08:24 AM
Post
#6
|
|
|
New Member Posts: 2 |
This is EXACTLY what I needed! Worked perfectly. Thanks so much to both of you!!!
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 25th May 2013 - 04:36 AM |