Calculating age in a form

  • Thread starter Thread starter Eric Muetterties
  • Start date Start date
E

Eric Muetterties

I want a field in a form that will read the birthdate
stored as date/time in a Table.

The birthdates are stored in the format mm/dd/yy.

What I want is to have the current age in years display in
a field in the form.

I have tried setting the default value of the control box
using Datediff with no success.

Here is what I had set as the default value:

=DateDiff("y",[Table1]![Birthday],Now())

Any help is much appreciated!
-Eric Muetterties
ericm1461 at comcast.net
 
Eric,

First of all, the expression you need would not go into the Default
Value property of the textbox, but into its Control Source property.

Try this...
=DateDiff("yyyy",[birthdate],Date())+(Format([birthdate],"mmdd")>Format(Date(),"mmdd"))

- Steve Schapel, Microsoft Access MVP
 
Back
Top