how do i use if/else in access update query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i am using an update query to create a field in an access table based on the
value of another field:
If a < 0 then x = b
else
x = a + b.

I am using a+b as x in the select statement, but need to add the condition.
Thanks for any help offered.
 
JErv said:
i am using an update query to create a field in an access table based on
the
value of another field:
If a < 0 then x = b
else
x = a + b.

I am using a+b as x in the select statement, but need to add the
condition.
Thanks for any help offered.

JErv,

The IF ELSE condition can be used within a query as follows:

To update field in an update query:
SET Field = IIF(A<0, B, A + B)

To create a field in a query:
IIF(A<0, B, A + B) AS MyNewField

Does this help?

-Randy
 
Back
Top