Automatically update "Age" field

G

Guest

I have a table that has a "birthdate" field as well as an "age" field.

How can I make my "age" field automatically update based on the current date
for today and as each new day comes?

Thanks in advance!
 
D

Douglas J. Steele

You don't. Instead, remove the age field completely from the table. Then,
create a query and add a computed field to that query that returns the age
(http://www.mvps.org/access/datetime/date0001.htm at "The Access Web" show
several approaches).

Use that query anywhere you would otherwise have used the table.

In general, it's considered a bad idea to store calculated fields. As fellow
MVP John Vinson likes to say "Storing derived data such as this in your
table accomplishes three things: it wastes disk space; it wastes time
(almost any calculation will be MUCH faster than a disk fetch); and most
importantly, it risks data corruption. If one of the underlying fields is
subsequently edited, you will have data in your table WHICH IS WRONG, and no
automatic way to detect that fact."
 
G

George Hepworth

You don't do this. Calculated fields should not be stored in a table. If you
need to display age in a form or report, you calculate it as part of the
query that provides the recordset for the form or report.
 

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

Similar Threads


Top