Link to home
Start Free TrialLog in
Avatar of Shen
ShenFlag for United States of America

asked on

ms access query update

I am trying to set an ms access query to update different fields in a table based on different values in another table.  If i run it the update below if erases the previous set values. Is there a way to nest these expression so that they only execute the condition when is true.

UPDATE [table1] INNER JOIN table2 ON [table1].field1 = table2.field1
  SET
     table1.field10  = IIF(table2.fieldz=17,-1),
     table1.field11 = IIF(table2.fieldz=18,-1),
     table1.field12 = IIF(table2.fieldz=19,-1),    
     table1.field13 = IIF(table2.fieldz,30,-1,IIF(table2.fieldz,44,-1,IIF(table2.fieldz,141,-1)))
 
WHERE table1.fieldB=2 ;
ASKER CERTIFIED SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Shen

ASKER

Excellent. That was the problem.

Thank you
Avatar of Shen

ASKER

Thank you
You're welcome:)