I have a table (TableA) with various fields in it (say FieldA, FieldB and FieldC). I need to add another field (FieldD) whose value depends on the values from the other three fields.
Field D = 1 if FieldA = 1
Field D = 2 if FieldA = 2 and FieldB = 2
Field D = 3 if FieldA = 2 and FieldB = 4
Field D = 0 in all other cases.
Here is where my knowledge of Access shows (or doesn’t show is more accurate). To do this, I would (in this order) …
a) change the structure of TableA to include a new field (FieldD)
write an update query “UPDATE TableA SET FieldD = 0”
c) write an update query “UPDATE TableA SET FieldD = 1 WHERE FieldA=1”
d) write an update query “UPDATE TableA SET FieldD = 2 WHERE FieldA=2 AND FieldB=2”
e) write an update query “UPDATE TableA SET FieldD = 3 WHERE FieldA=2 AND FieldB=4”
I’m hoping that there is an easier way – maybe combining the 4 queries down to 1?