Ulises,
IIF() returns an expression, yours;
IIF(Something,"Thisform.textwhatever.forecolor=blah blah",...)
is returning the expression, it is not assigning the value. You could try this;
Thisform.textWhatever.ForeColor = IIF(Whatevercondition,RGB(x,x,x),RGB(y,y,y))