Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create calculated field in MS Access table 5

Status
Not open for further replies.

MwTV

MIS
Mar 9, 2007
99
Have two fields in table; DateOfBirth and AnniversaryDate.

I would like to enter a new field in the table that is calculated by the following;
RemitDate = AnniversaryDate - DateOfBirth

What are the steps to accomplish this?
 
Generally, you would not create fields in a table to hold calculated values. You would generate the calculatine in a query/form/report.

In your example, it looks like you want to know the days/months/years(?) between two dates - if so, look in help for the DateDiff() function.

Max Hugen
Australia
 
Maybe you should read somethng like the following:
The Fundamentals of Relational Database Design

An obvious example of a dependency is a calculated column. For example, if a table contains the columns Quantity and PerItemCost, you could opt to calculate and store in that same table a TotalCost column (which would be equal to Quantity*PerItemCost), but this table wouldn't be 3NF
 
Table is for one-time use and Management desires the calculated column.

What is the most expedient method to accomplish?
 
use a query to calculate the values, then you can either put these values into a table, or just let management see the query

--------------------
Procrastinate Now!
 
Why is management looking at any tables anyway? Since it's a one-time thing, can't you just give them a report listing the tables columns with you calculated fields?
 
A solution would be to Add your calculated field, RemitDate as long Integer, then update that field with an update query:

"UPDATE
SET RemitDate = DateDiff("yyyy",[DateOfBirth],[AnniversaryDate]);"

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top