appending records

  • Thread starter Michel Khennafi
  • Start date
M

Michel Khennafi

Good afternoon...

I would like to append records from 40 identical tables into one table (same
fields, same structure)

This is a heavy duty task and I would like to know if anyone has a method to
do it fast.

Thanks so much for your advices

MK
 
J

John W. Vinson

Good afternoon...

I would like to append records from 40 identical tables into one table (same
fields, same structure)

This is a heavy duty task and I would like to know if anyone has a method to
do it fast.

Thanks so much for your advices

MK

A couple of ways suggest themselves. One would be to create one (or maybe two,
40 is a lot of tables) UNION queries in the SQL window. Start by creating a
select query on one of the tables, selecting all the fields. Select View...
SQL from the menu, and edit the SQL text from something like

SELECT this, that, theother, who, what, IDontKnow
FROM Table1;

to

SELECT this, that, theother, who, what, IDontKnow
FROM Table1
UNION ALL
SELECT this, that, theother, who, what, IDontKnow
FROM Table2
UNION ALL
SELECT this, that, theother, who, what, IDontKnow
FROM Table3
<etc>

through all 40 tables. Use your own table and fieldnames of course.

Save this query and base an Append query on it.

OR... especially if this is something you'll be doing repeatedly, perhaps with
different tables...

create a "driver" table with a text field containing the SQL or the query
names of the append queries, a sequence number field, and a Yes/No field to
run the query. You can write some fairly simple code to open this driver table
as a recordset, sorted by the sequence field, with a criterion of True on the
yes/no field; loop through the records and use the Querydef Execute method to
run the queries in sequence.

John W. Vinson [MVP]
 
L

Larry Linson

Michel Khennafi said:
I would like to append records from 40 identical
tables into one table (same fields, same structure)

This is a heavy duty task and I would like to know
if anyone has a method to do it fast.

While there are situations where this may be needed, having 40 identical
tables almost always means that there is a basic flaw in the design of the
database, very likely that the name of the tables represents data that
should be in a table field with all the records in a single table. This
would be a good time to review the database design to determine if that is
what you have.

Larry Linson
Microsoft Access MVP
 
M

Michel Khennafi

Hi there, there is no design flaw...

We have submitted a bid to 40 vendors and obtained 40 answers we are tryiong
to group together in a table...

Each one oif the 40 tables contains the answers from one vendor...
 
J

John W. Vinson

Hi there, there is no design flaw...

We have submitted a bid to 40 vendors and obtained 40 answers we are tryiong
to group together in a table...

Each one oif the 40 tables contains the answers from one vendor...

Are they sending you Access databases (.mdb files) with their answers? They
certainly cannot be sending you Access tables, since a Table has no existance
external to a database!

What exactly are the vendors sending you?

Did the UNION query work?

John W. Vinson [MVP]
 
Top