Dear All,
Need help in creating formula in the forms . I am trying to subtract (expiring date - start date = Duration) . Can some please help me out in this.
Thanks in advance.
Regards,
Mastee
Dear All,
Need help in creating formula in the forms . I am trying to subtract (expiring date - start date = Duration) . Can some please help me out in this.
Thanks in advance.
Regards,
Mastee
=IIf(IsNull([expiring date]-[start date]),0,([expiring date]-[start date]))
you can stick with just =[expiring date]-[start date] if you want but the reason for the iif statement is to not leave you with blanks in case of null values. In access, any calculation with a Null returns Null. the iif statement will catch that. Feel free to replace the 0 with whatever you want (dont forget " " for strings).
If that's all you need, please mark thread solved.
Thanks Shabz . I tried but its giving me error.
The above should return the number of days between [Start Date] and [End Date]. If either of the dates isn't entered, then it will display 0.Code:=Iif(IsNull([Start Date]),0,Iif(IsNull([End Date]),0,DateDiff("dd",[Start Date],[End Date])))
If you want the difference in months, just change "dd" to "mm". Or "yyyy" for years.