date calculation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In my Control Source I have the following:

=[daterel1]-[datefiled1]
ex. 05/08/2003-10/14/2002=216

What I need is if the value returned is 0 (there will be nothing in the
daterel1 or datefiled1 field, I need the field to populate with 0. (I tried
putting a default value but nothing shows up and I need to calculate off this
field)
 
You'll want to use the Nz function so that if the date is Null, it will
return a value of 0. Change it to:

=Nz([daterel1])-Nz([datefiled1])

Linda
 
That works, but if I have dates in those fields it should not be returning a
0 but the number of days
Linda Burnside said:
You'll want to use the Nz function so that if the date is Null, it will
return a value of 0. Change it to:

=Nz([daterel1])-Nz([datefiled1])

Linda


dchristo said:
In my Control Source I have the following:

=[daterel1]-[datefiled1]
ex. 05/08/2003-10/14/2002=216

What I need is if the value returned is 0 (there will be nothing in the
daterel1 or datefiled1 field, I need the field to populate with 0. (I
tried
putting a default value but nothing shows up and I need to calculate off
this
field)
 
Thank you so much, that worked beautifully, just had to change abit, but got
me on the right track.

Linda Burnside said:
You'll want to use the Nz function so that if the date is Null, it will
return a value of 0. Change it to:

=Nz([daterel1])-Nz([datefiled1])

Linda


dchristo said:
In my Control Source I have the following:

=[daterel1]-[datefiled1]
ex. 05/08/2003-10/14/2002=216

What I need is if the value returned is 0 (there will be nothing in the
daterel1 or datefiled1 field, I need the field to populate with 0. (I
tried
putting a default value but nothing shows up and I need to calculate off
this
field)
 
Back
Top