Copy Records from One Table to Another

Luigi_Cortisone

Registered User.
Local time
Today, 20:01
Joined
Dec 10, 2008
Messages
24
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
 
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).
 
Can I use one append query to update a table from multiple source tables one source table at a time?
 
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.
 
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
 
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)
 
Thanks big guy, that looks potentially quite exciting. I'll give it a try at home tonight

Cheers, Luigi
 
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.
 
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
 

Users who are viewing this thread

Back
Top Bottom