Update query help

F

Floyd Forbes

I have Two tables with the same information. Table Two has a column called
Errors with data.
How can I update table one Error column with the same info in table two
errror column.

table 1
table 2
nameid name date items errors nameid
name date items errors
100 Floyd 2/5/08 2500 100
Floyd 2/5/08 2500 4
200 Anna 2/5/08 6000 200
Anna 2/5/08 6000 7
 
J

John Spencer

Use an update query. Perhaps that would look like the following.
STEP 1: BACKUP your data before attempting the following.
STEP 2: BACKUP your data before attempting the following.

Without a backup you cannot restore the data if this does not work the way
you expect.

UPDATE Table1 INNER JOIN Table2
ON Table1.NameID = Table2.NameID
AND Table1.Name = Table2.Name
AND Table1.Date = Table2.Date
AND Table1.Items = Table2.Items
SET Table1.Errors = Table2.Errors

In the query grid (Design view)
-- add both tables
-- drag from each set of matching fields
-- add Table1.Errors to the fields
-- Select Query: Update query from the menu
-- TYPE the following in the update to "cell" under Table1.Errors
[Table2].[Errors]
-- Select Query: RUN from the menu

If the two tables are identical in structure and contents then why do you
have two tables? I am guessing that table2 is a subset of the records in
table1 and you only need table2 on a temporary basis to update table1.



--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top