Age Calc as of July 1

S

SamDev

In a form, I want to calculate the age of customers as of July 1st - I want
to be able to look at the age at any point in time during the current year
and know the customer's age of July 1st. I have come up (with help from the
newsgroups) with the formula below BUT I don't want to go into the formula
each year and change the #2005/07/01# to #2006/07/01# etc.....

=DateDiff("yyyy",[Date of Birth],#2005/07/01#)+(Format([Date of
Birth],"mmdd")<Format(#2005/07/01#,"mmdd"))

Any ideas?

Thx!
 
J

John Vinson

In a form, I want to calculate the age of customers as of July 1st - I want
to be able to look at the age at any point in time during the current year
and know the customer's age of July 1st. I have come up (with help from the
newsgroups) with the formula below BUT I don't want to go into the formula
each year and change the #2005/07/01# to #2006/07/01# etc.....

=DateDiff("yyyy",[Date of Birth],#2005/07/01#)+(Format([Date of
Birth],"mmdd")<Format(#2005/07/01#,"mmdd"))

Any ideas?

Thx!

WHICH July 1st? The most recent previous one, the current year's July
1st, or the next one coming up?

Assuming the most recent previous:

DateDiff("yyyy", DateAdd("m", -6, [Date Of Birth]),
DateSerial(Year(Date()), 1, 1))


John W. Vinson[MVP]
 
M

Michel Walsh

Hi,



you could be able to use :


=DateDiff("yyyy",[Date of Birth],DateSerial( Year(Now()), 7,
1))+(Format([Date of
Birth],"mmdd")<"0701")





Hoping it may help,
Vanderghast, Access MVP
 

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