UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Calculating age from date of birth to a set future date    
 
   
Rynorem
post Oct 1 2009, 07:45 AM
Post #1

New Member
Posts: 9



Here's what I've got.
In the Query field:
I need to calculate an age from the DOB (date of Birth) to a specified date (3/1/2010).
I've used DateDiff("yyyy",[DOB],DATE())+(Format([DOB],"mmdd")>Format(DATE(),"mmdd")) in the query and it gave me thier current age. But I need it from the future date of Mar. 01 2010 (3/1/2010). When I replaced the DATE() with 3/1/2010 it gave me a large negative number. Please help.

Jamie
Go to the top of the page
 
+
debra_dixon
post Oct 1 2009, 08:04 AM
Post #2

UtterAccess Guru
Posts: 637
From: Virginia



Did you put # around the set future date?
Go to the top of the page
 
+
Rynorem
post Oct 1 2009, 08:33 AM
Post #3

New Member
Posts: 9



Yes with the same results---negative number
Go to the top of the page
 
+
truittb
post Oct 1 2009, 09:02 AM
Post #4

Retired Moderator
Posts: 13,544
From: Texas (Is there anywhere else?)



This works for me

DateDiff("yyyy",[DOB],#3/1/2010#)+(Format([DOB],"mmdd")>Format(#3/1/2010#,"mmdd"))

The only way I could get a negative number was to leave off the # delimiters.

You might check the date in DOB if it still does not work.
Go to the top of the page
 
+
akn_39
post Oct 1 2009, 09:05 AM
Post #5

UtterAccess Enthusiast
Posts: 72
From: Victoria, BC



Would this work for you:

Age() Function (Allen Browne)

Tony N.
Go to the top of the page
 
+
Rynorem
post Oct 1 2009, 09:13 AM
Post #6

New Member
Posts: 9



Thanks, Truittb. I copy paste it into the field and it worked. I compared the two and couldn't find a difference but it work so thanks.
Go to the top of the page
 
+
truittb
post Oct 1 2009, 10:50 AM
Post #7

Retired Moderator
Posts: 13,544
From: Texas (Is there anywhere else?)



You are welcome.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th May 2013 - 02:06 AM