Age Field

G

Guest

Hi,

I have researched and it appears that I can calculate the age of an
individual based on the DOB within a form or report.

From what I gather, it is impossible to create an actual field that contains
the age, though. I would need this, as will be transferring the Access data
to another software package in order to perform statistical analysis.

Impossible?
 
D

Douglas J. Steele

You probably don't need an Age field.

Create a query that contains all of the fields currently in your table.

Add a computed field to that query that computes the Age based on the DOB
field:

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

Use the query wherever you would otherwise have used the table.
 
A

Allen Browne

It's not impossible, Dee. It's just unnecessary. With just a few hundred
people in the database, you would have to run a routine *every* day to try
to keep all the ages up to date. Who needs that when there's a dead-easy,
maintenance-free solution.

Just create a query, and show the age as a calculated field in the query.
You can then use the query anywhere you could use the table, including
exporting to other software.

Here's how:
http://allenbrowne.com/func-08.html
 
G

Guest

Dee,

An Age field stored in a table would potentially need to be updated every
day to ensure that each one is current. Simply use a calculated field in a
query to calculate the age when you need it, and export the query to your
statistical analysis program:

In the Field row of the query, enter:

Age: YourCalculation([DOB])

Hope that helps.
Sprinks
 
G

Guest

Thanks to all of you for your help. I am starting a new database from
scratch, so will probably be posting LOTS of questions!
--
Thanks!

Dee


Allen Browne said:
It's not impossible, Dee. It's just unnecessary. With just a few hundred
people in the database, you would have to run a routine *every* day to try
to keep all the ages up to date. Who needs that when there's a dead-easy,
maintenance-free solution.

Just create a query, and show the age as a calculated field in the query.
You can then use the query anywhere you could use the table, including
exporting to other software.

Here's how:
http://allenbrowne.com/func-08.html
 
D

Douglas J. Steele

Sprinks said:
Dee,

An Age field stored in a table would potentially need to be updated every
day to ensure that each one is current.

Potentially? Does that mean you've discovered how to stop aging? <g>
 
J

John W. Vinson

From what I gather, it is impossible to create an actual field that contains
the age, though. I would need this, as will be transferring the Access data
to another software package in order to perform statistical analysis.

Just to add to the other comments - if you assume that you must have data
stored in a table to export it to another software package, that assumption is
WRONG. You can export from a Query just as easily as from a Table.

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