R
Rich
Guest
Any ideas how I can make this statement more efficient in a module?
ContractLength: IIf(IsNull([EndOfContract]),IIf(Day(Date())<Day([StartOfContract]),DateDiff("m",[StartOfContract],Date())-1,DateDiff("m",[StartOfContract],Date()))+1,IIf(Day([EndOfContract])< ;Day([StartOfContract]),DateDiff("m",[StartOfContract],[EndOfContract])-1,DateDiff("m",[StartOfContract],[EndOfContract]))+1)
Although it works as is I need to add another statement that if the end of contract is greater than todays date it will only calculate up to today and not straight to the end of contract.
ContractLength: IIf(IsNull([EndOfContract]),IIf(Day(Date())<Day([StartOfContract]),DateDiff("m",[StartOfContract],Date())-1,DateDiff("m",[StartOfContract],Date()))+1,IIf(Day([EndOfContract])< ;Day([StartOfContract]),DateDiff("m",[StartOfContract],[EndOfContract])-1,DateDiff("m",[StartOfContract],[EndOfContract]))+1)
Although it works as is I need to add another statement that if the end of contract is greater than todays date it will only calculate up to today and not straight to the end of contract.