Combining two tables

D

Dumb Blonde

I'm trying to combine two tables into one table. Each has the same field
names, types, etc but they don't have any data to perform a join on (in other
words, they contain completely different data). I've tried an append query
and a make new table query but haven't had any luck.

Any suggestions?
 
G

Graham R Seach

Dumbo,

If they have the same column names, then you can use a UNION query, which
has the following syntax:
SELECT * FROM Table1
UNION [ALL]
SELECT * FROM Table2

If you use the ALL keyword, duplicates will be included.

However, if all you're trying to do is add one table's data to the other,
then an INSERT query will work:
INSERT INTO Table1 SELECT * FROM Table2

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
 
J

John Vinson

I'm trying to combine two tables into one table. Each has the same field
names, types, etc but they don't have any data to perform a join on (in other
words, they contain completely different data). I've tried an append query
and a make new table query but haven't had any luck.

Any suggestions?

An Append query should work. You would create a Query based on TableA
(*without* joining it to TableB, or indeed mentioning TableB at all,
since you don't have a joinfield); change it to an Append query using
the query type icon, you'll then be asked what you want to append to.
That's when you select TableB.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Top