date functions

  • Thread starter Thread starter ScottM
  • Start date Start date
S

ScottM

Can someone,please, review this equation and tell me why i
get an error?

=DateAdd("d",(Diff2Dates("d",[StartBiS],[EndBiS],True)),
[servicedt])

StartBiS = beginning date of break in service (manually
entered field)

EndBiS = end date of break in service (manually entered
field)

servicedt = service date (previously entered value from
another field)

Ideally, I'd like this to calculate the new service date
from the items listed, but only through one iteration.
the date provided would be posted to the service date
field. I figure I might need some type of "calculate"
button to make that happen just the one time.

TIA
 
ScottM said:
Can someone,please, review this equation and tell me why i
get an error?

=DateAdd("d",(Diff2Dates("d",[StartBiS],[EndBiS],True)),
[servicedt])

StartBiS = beginning date of break in service (manually
entered field)

EndBiS = end date of break in service (manually entered
field)

servicedt = service date (previously entered value from
another field)

Ideally, I'd like this to calculate the new service date
from the items listed, but only through one iteration.
the date provided would be posted to the service date
field. I figure I might need some type of "calculate"
button to make that happen just the one time.

Diff2Dates() is not a built-in VBA function like, say, DateDiff().
First, have you defined the Diff2Dates function in a standard module?
The only Diff2Dates function that I'm familiar with is this one by
Graham Seach and Doug Steele:

http://members.rogers.com/douglas.j.steele/Diff2Dates.html

If this is the function you're using, it returns a string such as "23
days", which is not valid as the Number argument of the DateAdd()
function. I think for your purposes you would want to use the built-in
DateDiff function instead.
 
Back
Top