Display Age on Form

  • Thread starter Thread starter Mary M
  • Start date Start date
M

Mary M

How can you convert a date dd/mm/yyyy to an age us the following formula:

=DateDiff("yyyy", [Insert Date of Birth], Now())+ Int( Format(now(), "mmdd")
< Format( [Insert Date of Birth], "mmdd") )

ie. If a table has a birthdate field I would like to just display the Age
on a form and not the
date. How is this done? I have some TEXT boxes that will only display if a
certain value is true. However, the text in the text box never changes. How
can I do the same thing using the age? The value will change for each
record, and that's where I am stumped.

Many thanks in advance for any assistance.
 
How are you trying to use that formula? I'd actually put it in a query and
base your form on that query. (I'd also replace the Now() function with the
Date() function, although that's not important)
 
How are you trying to use that formula?

It was given to me. I want the form to display an age of each record based
on a date field of mm/dd/yyy
Is there a better one for this?
I'd actually put it in a query and base your form on that query

How would you do this? I can make a query, but how can it display on a form?
I basically want the age to appear as a number on the form, I suppose I
could add a calculated field to the table and then display it, however, I
was hoping for an easier solution. Any ideas?

Mnay thanks again..
 
Mary M said:
It was given to me. I want the form to display an age of each record based
on a date field of mm/dd/yyy
Is there a better one for this?

I was curious as to what you'd already tried to do with it, and what
error(s) (if any) you were encountering.
How would you do this? I can make a query, but how can it display on a
form?
I basically want the age to appear as a number on the form, I suppose I
could add a calculated field to the table and then display it, however, I
was hoping for an easier solution. Any ideas?

NO! Don't add a calculated field to the table.

Create a query with a computed field in it. You'd do this by adding all of
the fields of interest to you in the query, then typing the following in a
blank cell on the "Field" row of the grid:

Age: DateDiff("yyyy", [DOB], Date())+ Int(Format(Date(), "mmdd")< Format(
[DOB], "mmdd"))

Base your form on that query instead of on the table. You'll now have
another field "Age" that you can add to your form.
 

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

Back
Top