Luigi_Cortisone
01-27-2009, 02:34 PM
Hi
I have two source tables 'links' and 'switches'
I want to copy just the fields 'id' and 'age' from each table into the 'summarytable'
Can someone help with some vba that would do the trick
Thanks, Luigi
pbaldy
01-27-2009, 02:55 PM
No VBA required. Try an append query. If you're not familiar with them, create a query that gets the records you want to append, then change it to an append query (Query/Append Query).
Luigi_Cortisone
01-27-2009, 02:57 PM
Can I use one append query to update a table from multiple source tables one source table at a time?
pbaldy
01-27-2009, 03:01 PM
Not sure what your data looks like and what you want the end product to be, but it sounds like you may want a UNION query.
Luigi_Cortisone
01-27-2009, 03:13 PM
The source tables contain a large number of fields however I just want two the id and age to insert into one master table.
How would I use a Union query to work on multiple source tables and one destination table?
Thanks
pbaldy
01-27-2009, 04:00 PM
Something like this (I think the subquery is required in this situation, though I may be wrong):
INSERT INTO DestinationTable(Field1, Field2)
SELECT Field1, Field2 FROM
(SELECT Field1, Field2
FROM SourceTable1
UNION ALL
SELECT Field1, Field2
FROM SourceTable2)
Luigi_Cortisone
01-27-2009, 04:04 PM
Thanks big guy, that looks potentially quite exciting. I'll give it a try at home tonight
Cheers, Luigi
gemma-the-husky
01-28-2009, 12:27 AM
luigi, although you can do pretty well anything in access, it is often a question of "why?".
for the most part you can prioduce results by developing queries, which summarise your data, without needing to put the data in a new table.
what are you trying to do, because there may well be an easier way.
Luigi_Cortisone
01-28-2009, 09:08 AM
My source tables all have different fields except for two fields which are common to all. I wanted to extract this data from each table and produce a 'master table'. That union query did exactly what I was after however if there is a better way I would appreciate it.
Thanks again for your help
Cheers, Luigi