DateDiff

leepem

New member
Local time
Today, 06:55
Joined
Jul 20, 2006
Messages
5
I have the following formula entered in a text box on a report

=DateDiff("d",[StartDate],[EndDate])

however if there is no EndDate then i need it to calculate the StartDate (N.B. there will always be a StartDate) from todays date in the same text box.

Can anyone please help!!!

thanks
 
Use an IIF function. Something like.. . . . .

Code:
IIf IsNull([EndDate],DateDiff("d",[StartDate],[EndDate]),DateDiff("d",[StartDate],Date))

Note, I haven't checked the syntax, but its close!

Col
 
in the end it was:

=IIf(IsNull([EndDate]),DateDiff("d",[StartDate],[Text23]),DateDiff("d",[StartDate],[EndDate]))

thanks for your help
 

Users who are viewing this thread

Back
Top Bottom