I have the following IIF statement in one of my queries. The query works and returns the expected results but I wondered if there was an easier way to return the max of two values rather than using the two IIF statements below or any suggestions on how to make this query more efficient?
Thank you for any suggestions
Code:
TotalNAppliedByOM: Round(Sum(IIf([UseInRegCalculations]=Yes,([OMApplicationRate]*[NValueFarmersOwn]),
(IIf([tblCropping].[CroppingYear]<2011,
IIf([NValueFarmersOwn]>[NValue7thRB209],([OMApplicationRate]*[NValueFarmersOwn]),([OMApplicationRate]*[NValue7thRB209])),
IIf([NValueFarmersOwn]>[NValue8thRB209],([OMApplicationRate]*[NValueFarmersOwn]),([OMApplicationRate]*[NValue8thRB209])))))))
Thank you for any suggestions