You're confusing VFP. "SELECT" is a (built-in) SQL command, a built-in command to change the current work area, and it's also a function which returns the currently selected work area number.
In addition, IIF() is a function which takes expressions (something that evaluates to a single value) as its parameters. The SQL SELECT and UPDATE commands don't do that, even when you wrap them in parentheses. It's really for returning one of two values based on the value of the first parameter - it's really not for control flow logic. I suggest rewriting your code in the form of an IF .. ELSE.. ENDIF block.