Date value

D

Dr. Maunuk

I want an Age of a person on the particular date when I acess the database.
I want age to appear automatically on entering Birth Date of person only.
 
J

Jeff Boyce

Check mvps.org/access for functions that calculate age...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

John Vinson

I want an Age of a person on the particular date when I acess the database.
I want age to appear automatically on entering Birth Date of person only.

Just put a calculated field in a Query or as the control source of a
form or report textbox:

Age: DateDiff("yyyy", [Birth Date], Date()) - IIF(Format(Date(),
"mmdd") < Format([Birth Date], "mmdd"), 1, 0)


John W. Vinson[MVP]
 
D

Dr. Maunuk

Thanks John for your reply.
But On entering your given expression in control source, I am getting age
being displayed 0 only.

John Vinson said:
I want an Age of a person on the particular date when I acess the database.
I want age to appear automatically on entering Birth Date of person only.

Just put a calculated field in a Query or as the control source of a
form or report textbox:

Age: DateDiff("yyyy", [Birth Date], Date()) - IIF(Format(Date(),
"mmdd") < Format([Birth Date], "mmdd"), 1, 0)


John W. Vinson[MVP]
 
J

John Vinson

Thanks John for your reply.
But On entering your given expression in control source, I am getting age
being displayed 0 only.

What is the value of [Birth Date] in your table? For that matter what
is its datatype? And could you post the exact expression you're using
I want an Age of a person on the particular date when I acess the database.
I want age to appear automatically on entering Birth Date of person only.

Just put a calculated field in a Query or as the control source of a
form or report textbox:

Age: DateDiff("yyyy", [Birth Date], Date()) - IIF(Format(Date(),
"mmdd") < Format([Birth Date], "mmdd"), 1, 0)
[/QUOTE]


John W. Vinson[MVP]
 
D

Dr. Maunuk

Thanks John. I worked.
Can you help me to get same result with table?
how to enter todays date automatically in a table?

John Vinson said:
Thanks John for your reply.
But On entering your given expression in control source, I am getting age
being displayed 0 only.

What is the value of [Birth Date] in your table? For that matter what
is its datatype? And could you post the exact expression you're using
On Mon, 25 Sep 2006 08:23:02 -0700, Dr. Maunuk

I want an Age of a person on the particular date when I acess the database.
I want age to appear automatically on entering Birth Date of person only.

Just put a calculated field in a Query or as the control source of a
form or report textbox:

Age: DateDiff("yyyy", [Birth Date], Date()) - IIF(Format(Date(),
"mmdd") < Format([Birth Date], "mmdd"), 1, 0)


John W. Vinson[MVP]
[/QUOTE]
 
J

John Vinson

Thanks John. I worked.
Can you help me to get same result with table?
how to enter todays date automatically in a table?

You would not WANT to do so. If you entered a record today, it would
be wrong tomorrow! Tables should not contain variable or calculated
data. Could you explain what you are trying to accomplish by doing so?

John W. Vinson[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