IIf function

  • Thread starter Thread starter Kali
  • Start date Start date
K

Kali

Does anyone know how I can make this If statement simplier? I want it to
display 4 if the cells shows "acquistion" etc... and otherwise blank.

IIf([TRANS_TYPE]="ACQUISITION",4,IIf([TRANS_TYPE]="ADDITIONS",1,IIf([TRANS_TYPE]="DEPR EXPENSE",2,"")))
 
(note - Access doesn't have "cells")

IIF([Trans_Type] = "Acquisition", 4, "")

By the way, consider creating a table of valid [Trans_Type] values, and
their corresponding (whatever '4' is). Then you won't have to locate all
your IIF() statements when things change!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Hi Kali,

Definitely a code table as Jeff mentioned. However, without a code
table you can use the Switch() function.

Switch([TRANS_TYPE]="ACQUISITION",4,[TRANS_TYPE]="ADDITIONS",1,[TRANS_TYPE]="DEPR EXPENSE",2,true,"")

Clifford Bass
 
Back
Top