There is the native Access Iif function (immediate If)
that you can use in expressions, then there is the VBA IF
statement you can use in writing your own functions. Both
can be nested.
For the Iif Function:
=Iif([CODE1]="A","X",Iif([CODE2]="B","Y","Z"))
This checks the field CODE1 and if it is A results in the
value X. If not, it then checks CODE2 and if CODE2 is B
sets the result to Y. If neither of the conditions is
true it sets the result to Z.
For VBA code:
Function IFDEMO(Code1 as String, Code2 as String) As String
IF Code1 = "A" Then
IFDEMO = "X"
Else
If Code2 = "B" Then
IFDEMO = "Y"
Else
IFDEMO = "Z"
End If
End If
End Function
This uses variables instead of field values, but the logic
is the same.
HTH...
K Dales