You can't use IIF to change the columns in conditions nor you can use it to change operators. But you can use it to change the values for conditions.
I don't quite understand the logic for the LIKE statements. In another case you have
COMPONENTE.Vinculado_Eq LIKE ''
and in another
COMPONENTE.Vinculado_Eq LIKE '%'
Neither of these make sense to me since the first one searches for empty strings and the second one for anything.
But if we have a look at the condition
iif( ''= 'C', CORRECTIVOS.Cerrada = 'True', CORRECTIVOS.Cerrada = 'False')
This could be transformed as
CORRECTIVOS.Cerrada = IIF(condition goes here, 'True', 'False')
So perhaps the where clause should be something like (not certain about the logic)
WHERE
CORRECTIVOS.COM= COMPONENTE.Codigo AND
CORRECTIVOS.SUB= COMPONENTE.Vinculado_Sb AND
CORRECTIVOS.EQU= COMPONENTE.Vinculado_Eq AND
(
CORRECTIVOS.Fecha_OTC BETWEEN Convert(datetime, '05/01/2011', 103) AND Convert(datetime, '16/01/2015', 103)
) AND
(
COMPONENTE.Vinculado_Eq LIKE iif( '' <> '', '', '%') AND
COMPONENTE.Vinculado_Sb LIKE iif( '' <> '', '', '%') AND
COMPONENTE.Codigo LIKE iif( '' <> '', '', '%')
) AND
(
CORRECTIVOS.Cerrada = iif(''= 'A', 'False', 'True') OR
CORRECTIVOS.Cerrada = iif(''= 'C', 'False', 'False')
)
) AND
(
CORRECTIVOS.Mejora = iif(''='M', 'True', 'False') AND
CORRECTIVOS.Apoyo = iif(''='O', 'True', 'False')
)
)
)
Sorry about the typos :)