Discussion:
Calculation on AGE based on Year
(too old to reply)
l***@hotmail.com
2014-12-06 16:12:09 UTC
Permalink
Hi,

I'm having a trouble to create a default on December 31.

For example:

Birthday on December 31, 1970 and want to create a year format. I want to add 25.999 years later... it comes to December 31, 1997. It should be 1997 not 1998.

Can you tell me how to create this to make it 1997 instead of 1998?

Thanks
John W. Vinson
2014-12-07 00:01:38 UTC
Permalink
Post by l***@hotmail.com
Hi,
I'm having a trouble to create a default on December 31.
Birthday on December 31, 1970 and want to create a year format. I want to add 25.999 years later... it comes to December 31, 1997. It should be 1997 not 1998.
Can you tell me how to create this to make it 1997 instead of 1998?
Thanks
A default for... what? You should not be storing the age in any table field;
just calculate it dynamically as needed:

Age: DateDiff("yyyy", [DOB], Date()) - IIF(Format(Date(), "mmdd") <
Format([DOB], "mmdd"), 1, 0)

This will compare today's date to the birthdate, count years, and subtract one
year if the birthday anniversary has not been reached.

I have NO idea what you mean by "add 25.999 years" or how you tried to do it,
nor what you mean by "create a year format".
--
John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://answers.microsoft.com/en-us/office/forum/access?tab=question&status=all
http://social.msdn.microsoft.com/Forums/office/en-US/home?forum=accessdev
and see also http://www.utteraccess.com
Loading...