Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / September 2007

Tip: Looking for answers? Try searching our database.

Automatically update "Age" field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cwalker0012 - 18 Sep 2007 19:56 GMT
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!
Douglas J. Steele - 18 Sep 2007 20:25 GMT
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."

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

>I have a table that has a "birthdate" field as well as an "age" field.
>
[quoted text clipped - 3 lines]
>
> Thanks in advance!
George Hepworth - 18 Sep 2007 20:27 GMT
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.

>I have a table that has a "birthdate" field as well as an "age" field.
>
[quoted text clipped - 3 lines]
>
> Thanks in advance!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.