Update Query, updating wrong table

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
 
J

John Spencer

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
..
 

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