I don't know how could I miss IIF command. I didn't try it jet, but as I can see in your code, it is exactly command I've been looking for.

Thanks, Ermin