Help get me started: transfer query

D

denton

I have a two tables, both have the same schema. How can I use a query to
transfer the rows from 1 table over to another table?
 
R

Rob Parker

Use an Append query:
INSERT INTO tblTable1Name SELECT * FROM tblTable2Name;

This will work provided:
1. the field names in both tables are the same
2. there is no autonumber field in either table
3. there is no indexed field with "No Duplicates" in the first table

If any of these conditions are true, you will need to be more specific in
the fields you append, and/or turn off the "no duplicates" setting. If you
are doing this in the query design grid, the steps are:
1. Add the second table to the table area at the top
2. Select the fields you want to append to the first table. If the field
names are the same, and there is no autonumber field, simply choose *; if
there is an autonumber field, do not include it (autonumbers will be
generated in the first table when the records are added), and if the field
names differ then you will need to select each field separately.
3. Covert the new query to an Append query (via the Query menu, or the
query type dropdown on the design toolbar or right-click menu), and
enter/select the first table's name in the Append to dialog.
4. If the field names are different in the two tables, select the field
names in the first table in the "Append To:" row which has appeared in the
query grid.

HTH,

Rob
 
Top