Birthday Calculation?

G

Guest

I have a calculated field that is trying to figure out someones age by using
2 fields.
One field has the current date with a Long Date Format. The other field
holds a birthdate (also long date format). It looks like this:

=DateDiff("yyyy",[DOB],[Text41])

It kind of works but the problem is that if a persons birthdate is in
November and they are currently 25 years of age (now in May) - the
calculation spits out 26 before November actually arrives.

Can anybody help?
 
G

Guest

Alex,

It's not working...I tried doing it as an Event Procedure on the Before
Update but no dice - I dont get an error but the field stays blank. Then i
tired it as an expression in the expression builder but had the same blank
result.????

Alex Dybenko said:
Try to look here:
http://www.mvps.org/access/datetime/date0001.htm

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com


Adam said:
I have a calculated field that is trying to figure out someones age by
using
2 fields.
One field has the current date with a Long Date Format. The other field
holds a birthdate (also long date format). It looks like this:

=DateDiff("yyyy",[DOB],[Text41])

It kind of works but the problem is that if a persons birthdate is in
November and they are currently 25 years of age (now in May) - the
calculation spits out 26 before November actually arrives.

Can anybody help?
 
G

Guest

Now I'm getting a negative one (-1) when i type it directly into the field.

Any other suggestions??

Alex Dybenko said:
Try to look here:
http://www.mvps.org/access/datetime/date0001.htm

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com


Adam said:
I have a calculated field that is trying to figure out someones age by
using
2 fields.
One field has the current date with a Long Date Format. The other field
holds a birthdate (also long date format). It looks like this:

=DateDiff("yyyy",[DOB],[Text41])

It kind of works but the problem is that if a persons birthdate is in
November and they are currently 25 years of age (now in May) - the
calculation spits out 26 before November actually arrives.

Can anybody help?
 
J

Jeff Conrad

in message:
I have a calculated field that is trying to figure out someones age by using
2 fields.
One field has the current date with a Long Date Format. The other field
holds a birthdate (also long date format). It looks like this:

=DateDiff("yyyy",[DOB],[Text41])

It kind of works but the problem is that if a persons birthdate is in
November and they are currently 25 years of age (now in May) - the
calculation spits out 26 before November actually arrives.

Adam,

Create an unbound text box on the form called txtAge and set it
to be Locked and not Enabled.

Set the Control Source of this text box to this

=DateDiff("yyyy",[DOB],Now())+Int(Format(Now(),"mmdd")<Format([DOB],"mmdd"))

That's all you need.
 

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