Calculation on AGE based on Year

L

learning_codes

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
 
J

John W. Vinson

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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top