Calculating age in a form

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
 
S

Steve Schapel

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
 

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