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 ;
ShenAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PatHartmanCommented:
For the first three, you only specified the true path.  You never specified what to do for the false path so you may end up with null.  For the fourth Item,  the syntax is incorrect and I'm not sure what your intention is.

UPDATE [table1] INNER JOIN table2 ON [table1].field1 = table2.field1
   SET
      table1.field10  = IIF(table2.fieldz=17,-1, table1.field10),
      table1.field11 = IIF(table2.fieldz=18,-1, table1.field11),
      table1.field12 = IIF(table2.fieldz=19,-1, table1.field12),    
      table1.field13 = IIF(table2.fieldz=30,-1,IIF(table2.fieldz=44,-1,IIF(table2.fieldz = 141,-1, table1.field13)))
 
 WHERE table1.fieldB=2 ;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ShenAuthor Commented:
Excellent. That was the problem.

Thank you
ShenAuthor Commented:
Thank you
PatHartmanCommented:
You're welcome:)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.