update query

G

Guest

I have two tables with the same 4 columns. The rest of the columns are
different. Table2 can have more rows than Table1. I'd like to get these 4
fields updated in Table1 from Table2 and if Table2 has more rows than Table1
that those rows would be included in Table1 with 0 or Null value in the rest
of fields.

I'm trying to do the following:

UPDATE Table1 RIGHT JOIN Table2 ON Table2 .Product_ID = Table1.Product_ID
SET Table1.Product_ID = Table2.[Product_ID], Table1.Description =
Table2.[Description], Table1.ProdCateg_Code = Table2.[ProdCateg_Code],
Table1.ProdCateg = Table2.ProdCateg], Table1.FY = Table2.[AdjY1F];

I'm getting all rows from the Table2 but everything is empty.

Could anybody clarify it.

Thanks
 
G

Guest

* I am not sure what you did but generally, I think you need 2 Queries: an
UPDATE Query to update the existing Records in Table1 (using INNER JOIN to
Tabl2) and an APPEND Query to add Records in Table 2 but not in Table1 into
Table1.

* If the use the Product_ID as the linking Fields, then the value in Table1
is the same with the corresponding value in Table2 so I am not sure why you
included Product_ID in the SET clause.

HTH
Van T. Dinh
MVP (Access)
 

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