Link to home
Start Free TrialLog in
Avatar of Conernesto
ConernestoFlag for United States of America

asked on

Query Expression for contentents of a field except some values

I have a table called Accounts. The table has two fields Accounts and Amounts. I am creating a query and need an expression that pulls amounts if the account is not account 1 or 5. Below is a sample of what I need. How do I write the expression?

Accounts      Amounts            Query Result wanted
1      100            0
2      200            200
3      300            300
4      400            400
5      500            0

conernesto
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan 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 Conernesto

ASKER

Accounts  Amounts    Expression Results wanted

1               100               0
2               200               200
3               300               300
4               400               400
5               500               0

The above is to clerify.
Can you provide the formula to enter the above in an expression since I will need to do more with this? For Example: Xpression: IIF([Account_tbl]![Account]?????.
That's part of the SQL statement....

The expression is:

IIF(Account= 1 OR Account = 5, 0, Amount)

Open in new window



You can assign it a column name like this:

NewAmount: IIF(Account= 1 OR Account = 5, 0, Amount)

Open in new window



(You can toggle between SQL view and Design  view to see it written both ways)