How to create an append query that appends to more than one table?

R

RockBennett

How do I create an append query that adds a group of records from one or more
tables to the end of one or more tables?
 
A

Allen Browne

JET can't do that.

You need to execute multiple append queries: one for each table you wish to
append to.
 
L

LeAnne

Query tab, "New," "OK," add desired tables and fields, click Query Type
button, select "Append Query."

That's about as much as we can do given the info that you provided.
Please remember, YOU can see your database; WE cannot. We have no idea
what your database looks like, what your table names & fields are, or
what you're trying to accomplish with them...for example, why you're
trying to store data redundantly. Post back with details and someone
will try to help.

Good luck,

LeAnne
 
J

Jerry Whittle

To add to the other knowledgeable replies, you can't really add records to
the end of a table. Beginning and end of a database table have no meaning. If
you put records into a table there is no guarantee that they will display in
that order any time that you open up the table in the future. Unless you have
a field to sort on when using a query, you just don't know what record is
first and last. Tables only store data like a bucket of water. Which drop is
the first; which drop is last?
 
R

RockBennett

Thanks Allen. Is there anyway to combine multiple append querries in one SQL
statement? Like a batch ...
 
R

RockBennett

Thanks Jerry. As you say they do not add to the end which is okay in my
situation. I am only trying to add the record(s) to the table.
 
A

Allen Browne

No. There is no batch.

You could write some VBA code that executes a series of SQL statements.
Something like this:
Dim db As DAO.Database
Dim strSql As String
Set db = dbEngine(0)(0)

strSql = "INSERT ..."
db.Execute strSql, dbFailOnError

strSql = "INSERT ..."
db.Execute strSql, dbFailOnError

'etc.
 
B

Bob Miller

Why would you want to duplicate records in a db? If you insist, you ca
create an append query for each table to which you wish to append th
data and run them in sequence via code or a macro. I would advis
against it, though. If the info changed for one record that is i
multiple tables you would have to change it in each table to b
current. Don't do it!
 
Top