Expression for age on specific date

manfbks

New Member
Joined
Jul 19, 2007
Messages
5
Using Access 2003, Windows XP
I have a birthdate field and need age as of 8/10/2007.

Using: =DateDiff("yyyy",[birthdate],"8/10/2007")

Not getting correct age for birthdates after the 10th of August in any year.

Seems simple, but haven't gotten it right in all our tries.
Mary Ann
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
It works for me, but maybe you have different default date format (but be sure that "birthdate" is in a date format).

In any event, try this:
Expr1: DateDiff("yyyy",[MyDate],DateSerial(2007,8,10))
 
Upvote 0
jm14, need more

Thanks for your reply, jm14, but your expression gives me the same result.

I have a "birthdate" field and need age as of August 10, 2007. If the birthdate is 8/9/1927 the age is 80 on 8/10/2007. If the birthdate is 8/10 or 8/11/2007 the age needs to be 79 because she hasn't had her birthday yet this year. I am getting 80 in all three cases and all birthdates after August 9th with my expression or your expression.

I am new to Access and don't have new ideas.
 
Upvote 0
Need more help with age query

Thank you Marbles. The expression from the Extracting Age topic board from Andrew Fergus works in the query I have created.

I have a Participants table, and a form and reports. I need to get the form and reports to use the age query. Can I get an Age column in the Participants table to use the query?

I can put the expression into the Age box on the form, but I don't know how to use the query there. My report was designed to use the typed number in the Age column in the Participants table, until I decided I wanted to use an expression instead. I know this is backwards, but can I modify to get what I want?

I'm sorry, I am so inexperienced that I don't even know if my question makes sense to anyone else.

Mary Ann
 
Upvote 0
You never want any calculations or calculated field in your base table. To keep things dynamic and to maintain database integrity, calculations like this are best done in a query.

The great thing is that any Form or Report can use the query as its Control Source instead of the table. So if you want these calculations to be available in your Form/Report simply change the Control Source to use your new query.
 
Upvote 0

Forum statistics

Threads
1,222,123
Messages
6,164,086
Members
451,872
Latest member
TimothyLynn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top