Current Age in Microsoft Access

B

Brian

Hello,
I have a table with data inside of it. I have a field call a persons date of
birth inside of it. I need to be able to have another field show the current
age of the person to todays date in the years and months format. If possible
I would like also to have the days in there.
Thanks
Brian
 
F

fredg

Hello,
I have a table with data inside of it. I have a field call a persons date of
birth inside of it. I need to be able to have another field show the current
age of the person to todays date in the years and months format. If possible
I would like also to have the days in there.
Thanks
Brian

There is absolutely no need to multipost to 7 or 8 newsgroups. All you
are doing is wasting the time of, and alienating, many possible
repliers who wade through your same message in each of the groups.

Please read this groups Netiquette (FAQ) found at
http://www.mvps.org/access

and then post again, to just the 1 or 2 groups that are pertinent to
your question. Act responsibly.
 
A

Arvin Meyer [MVP]

Brian said:
Hello,
I have a table with data inside of it. I have a field call a persons date of
birth inside of it. I need to be able to have another field show the current
age of the person to todays date in the years and months format. If possible
I would like also to have the days in there.
Thanks
Brian

(Stripping off the cross-posts). Have a look at the article at:

http://www.mvps.org/access/datetime/date0001.htm

which discusses how to do this accurately.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
B

Brian

I need to be able to get the date from one field called date of birth and
whats field name to use todays date for the second date.
 
S

Steve Schapel

Brian,

You would do this in a query, not in a table. You can then use this
query as the Record Source of your form or report where you want to
see/use the person's age in the format you want. The alias name that
you give the calculated field in the query doesn't matter, it's up to
you. You could call it Age :) Something like this...
Age: Diff2Dates("ymd", [date of birth], Date(), True)

First of all, ou will need to copy/paste the Diff2Dates function code
into a standard module in your database.
 
D

Douglas J Steele

Just a reminder that you cannot name the module Diff2Dates: module names
cannot be the same as function names.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Steve Schapel said:
Brian,

You would do this in a query, not in a table. You can then use this
query as the Record Source of your form or report where you want to
see/use the person's age in the format you want. The alias name that
you give the calculated field in the query doesn't matter, it's up to
you. You could call it Age :) Something like this...
Age: Diff2Dates("ymd", [date of birth], Date(), True)

First of all, ou will need to copy/paste the Diff2Dates function code
into a standard module in your database.

--
Steve Schapel, Microsoft Access MVP

I need to be able to get the date from one field called date of birth and
whats field name to use todays date for the second date.
 

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