BikeToWork
Programmer
I have several queries with the below nested IIF criteria. The field Project's 2nd character determines which option year a project is. If it is 4, the option year should be '4OY', if it is 3, the option year should be '30Y', if it is 2, the option year should be '2OY' and if it is 0 the option year could be either '1OY' or '0BY'. I am getting unexpected results from this nested IIF criteria, please help. Is there a better way of doing this like maybe a UDF or something besides a complex nested IIF?
IIf(Mid([tbl_Transactions].[Project],2,1)='4','4OY',IIf(Mid([tbl_Transactions].[Project],2,1)='3','30Y',IIf(Mid([tbl_Transactions].[Project],2,1)='2','2OY','1OY'))) Or IIf(Mid([tbl_Transactions].[Project],2,1)='4','4OY',IIf(Mid([tbl_Transactions].[Project],2,1)='3','30Y',IIf(Mid([tbl_Transactions].[Project],2,1)='2','2OY','0BY')))
IIf(Mid([tbl_Transactions].[Project],2,1)='4','4OY',IIf(Mid([tbl_Transactions].[Project],2,1)='3','30Y',IIf(Mid([tbl_Transactions].[Project],2,1)='2','2OY','1OY'))) Or IIf(Mid([tbl_Transactions].[Project],2,1)='4','4OY',IIf(Mid([tbl_Transactions].[Project],2,1)='3','30Y',IIf(Mid([tbl_Transactions].[Project],2,1)='2','2OY','0BY')))