View Single Post
  #5  
Old July 7th, 2008, 07:18 AM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Create Update Query

On Sun, 6 Jul 2008 21:16:00 -0700, Dave
wrote:

I have a number of text files that I have linked to within MS Access. I need
to combine these files into one. All files have the same number of columns
and column names. How do I do this?

I have started to create an Update Query with all the source tables in the
query design window. I have the fields of the destination table in the grid
of the query design window. I do not know what information to put into the
"Update To" grid of the design window.


An Update query updates existing records in a table, changing the value in the
record which is already there... not what you want!

Instead, create a local Access table, with all the datatypes and field sizes
that you want.

Then either do as Jeannette suggests and run multiple Append queries, or you
can build a UNION query and do it all in one shot: open a new query based on
one of the linked text files, include all the fields, and select View... SQL;
then copy and paste the SQL so that it resembles

SELECT file1.thisfield, file1.thatfield, file1.theotherfield FROM file1
UNION ALL
SELECT file2.thisfield, file2.thatfield, file2.theotherfield FROM file2
UNION ALL
etc through all the linked tables

Save this query and then base an Append query on it, appending into the new
empty Access table.
--

John W. Vinson [MVP]