G'Day again FRB,
Please try:
=DateDiff("yyyy",[Birthday], Now)
We're definitely on the right track.
I have located down a reference:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsfctdatediff.asp
for the vbScript DateDiff function.
"yyyy" is definitely the go for Years.
Near the very bottom of the page, just before the example, you will find:
"When comparing December 31 to January 1 of the immediately
succeeding year, DateDiff for Year ("yyyy") returns 1 even though
only a day has elapsed."
This was the basis for the doubt - I think you may have to create a
function to calculate the Years of Age correctly.
--
Regards,
Pat Garard
Melbourne, Australia
_______________________
FRB said:
G'Day to you Pat,
Unfortunately, changing the formula
=DateDiff("y",[Birthday], Now())
to
=DateDiff("yyyy",[Birthday], Now())
gives the following error message: "Error in Initial Value formula for
"Age" -- Missing operand before comma, ), or operator."
Thanks for trying.
FRB
Pat Garard said:
G'Day FRB,
1. In DateDiff and DateAdd, 'y' is the format for 'Day of Year' -
you need 'yyyy' for years:
=DateDiff("yyyy",[Birthday], Now())
2. I haven't tried it, but it may also help to format:
=Format(DateDiff("y",[Birthday], Now()),'y')
3. I have a sneaky feeling that this still MAY not correctly give
the age in years - but I could be wrong.
--
Regards,
Pat Garard
Melbourne, Australia
_______________________
I use a custom Contact form in which I want to use a custom fied I call
"Age"
and for which I want to calculate the age of the Contact. As the
initial
value of this field, I use the formula:
=DateDiff("y",[Birthday], Now())
[ie, I want to display a positive value for the difference in years
between
the current year and the Birthday year]
which does not give an answer. I have tried several other formulas
without
success.
Does anyone have a solution to this? Thank you very much.