Update Query, updating wrong table

  • Thread starter Thread starter matt17
  • Start date Start date
M

matt17

What am I doing wrong? Here is the SQL of the update query:
UPDATE tblTestUpdate INNER JOIN tblImportProducts ON
tblTestUpdate.MaterialNumber = tblImportProducts.MaterialNumber SET
tblImportProducts.Each = [tblTestUpdate].[Each]
WHERE (((tblImportProducts.Each)<>IsNull([tblImportProducts].
[Each])));

It keeps updating the wrong table (tblImportProducts)... it will take
the value's which match from tblTestUpdate and put it in the
corresponding fields on tblImportProducts. I am trying to do the exact
opposite

Thanks,
Matt Pierringer
 
It is doing exactly what you have told it to do.
the value on the right side of the equal sign is assigned to the field on
the left side of the equal sign.

Perhaps you want the following:

UPDATE tblTestUpdate INNER JOIN tblImportProducts ON
tblTestUpdate.MaterialNumber = tblImportProducts.MaterialNumber
SET [tblTestUpdate].[Each] = tblImportProducts.Each
WHERE (((tblImportProducts.Each)<>IsNull([tblImportProducts].
[Each])));

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