How do I set up a multiple condition expression in Access

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

Guest

I want to set up an expression that does the following: I have two fields
'Impact' and 'Influence'; both of which contain either 0 or 1. I want to
create a third field 'Category' that displays A, B, C, or D depending on the
4 possible combinations of 0 and 1 in the 'Impact' and 'Influence' fields.
Please help
 
Well, first of all I hope you're not trying to store this in a table. You
should never store values which are completely derivable from the values of
other fields in the same row.

Use a computed field in a query. In an empty cell on the "Field" row of the
query builder, type the following:

Category: IIf([Impact] = 0, IIf([Influence] = 0, "A", "B"), IIf([Influence]
= 0, "C", "D"))

The expression above assumes:

Impact = 0, Influence = 0 ==> Category = A
Impact = 0, Influence = 1 ==> Category = B
Impact = 1, Influence = 0 ==> Category = C
Impact = 1, Influence = 1 ==> Category = D

Of course, are you positive Impact and Influence will never hold anything
else?
 

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

Back
Top