PC Review


Reply
Thread Tools Rate Thread

Birthday Calculation?

 
 
=?Utf-8?B?QWRhbQ==?=
Guest
Posts: n/a
 
      28th May 2005
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?

 
Reply With Quote
 
 
 
 
Alex Dybenko
Guest
Posts: n/a
 
      28th May 2005
Try to look here:
http://www.mvps.org/access/datetime/date0001.htm

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


"Adam" <(E-Mail Removed)> wrote in message
news:834C22BE-7CC7-4271-9744-(E-Mail Removed)...
>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?
>



 
Reply With Quote
 
=?Utf-8?B?QWRhbQ==?=
Guest
Posts: n/a
 
      28th May 2005
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" wrote:

> Try to look here:
> http://www.mvps.org/access/datetime/date0001.htm
>
> --
> Alex Dybenko (MVP)
> http://Alex.Dybenko.com
> http://www.PointLtd.com
>
>
> "Adam" <(E-Mail Removed)> wrote in message
> news:834C22BE-7CC7-4271-9744-(E-Mail Removed)...
> >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?
> >

>
>
>

 
Reply With Quote
 
=?Utf-8?B?QWRhbQ==?=
Guest
Posts: n/a
 
      28th May 2005
Now I'm getting a negative one (-1) when i type it directly into the field.

Any other suggestions??

"Alex Dybenko" wrote:

> Try to look here:
> http://www.mvps.org/access/datetime/date0001.htm
>
> --
> Alex Dybenko (MVP)
> http://Alex.Dybenko.com
> http://www.PointLtd.com
>
>
> "Adam" <(E-Mail Removed)> wrote in message
> news:834C22BE-7CC7-4271-9744-(E-Mail Removed)...
> >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?
> >

>
>
>

 
Reply With Quote
 
Jeff Conrad
Guest
Posts: n/a
 
      28th May 2005
"Adam" wrote in message:
news:834C22BE-7CC7-4271-9744-(E-Mail Removed)...

> 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.
--
Jeff Conrad
Access Junkie
Bend, Oregon


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with Between dates on birthday calculation Barry A&P Microsoft Access Reports 9 8th Jan 2010 10:57 PM
How to clear birthday events in the calendar without deleting birthday field data in the contacts? hoangvan.hn.vn@gmail.com Microsoft Outlook Interoperability 4 19th Jan 2008 01:43 AM
Adding years to a birthday/appointment (Joes 14 Birthday) : =?Utf-8?B?RlJa?= Microsoft Outlook Calendar 1 26th May 2005 06:00 AM
how to highlight the (date) object in form when birthday (last 14 days before birthday) bart van deun Microsoft Access Form Coding 1 1st Feb 2005 02:02 PM
range.calculation with UDF not working when calculation is set to automatic Brian Murphy Microsoft Excel Programming 5 14th Oct 2003 07:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:06 AM.