Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 30th, 2004, 12:28 AM
Registered User
 
Join Date: Jul 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Storing Calculated Fields

I have a calculated field called Saving which I want to store in the table. I know this isn't advisable, but I need to refer back to it constantly and want to know what the savings are when the information was entered. Does anyone know a way to do this?


 
Old August 30th, 2004, 07:31 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

Suggestion:

Avoid storing calculated fields. Create a table that stores this information and create a query and do your calculation there.

Take a look at the northwind access database that comes with MS Access

[u]Tables</u>
Order
Order Details

This will give you and idea on how to best approach your situation.


 
Old August 30th, 2004, 04:02 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Jemacc's advice is generally very true, but be careful to listen to what is asked. For example, Dearnne says, "...want to know what the savings are when the information was entered."

That raises a flag. Are you saying, Dearnne, that savings is dependent on WHEN it was entered and you need to save the number for historical reasons?

For example: exchange rates. Values based on those can be calculated; however, because exchange rates change daily, you WOULD have to store the actual exchange rate if you want to know what the value of something was from another country on a certain date.

In that case, Dearnne, you don't store the calculated value (listening Jemacc's good advice); you store the multiplier for that date, i.e. the exchange rate itself. Then if you want to know the value of something later, you THEN recalculate using the stored exchange rate.

So my question to you is, are you multiplying two numbers where the second number changes daily? If so, store the second number and its date, not the calculation of the two numbers. As jemacc says, you can recalculate anytime as long as you get the correct two numbers.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old September 2nd, 2004, 05:30 PM
Authorized User
 
Join Date: Jun 2003
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Greg, Isee your point and I agree. If I am keeping my checking account history and I want to keep a running balance. How would I apply your suggestion in order to get a balance on a particular day when I am depositing and also taking money out?





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create calculated fields MacDevv C# 3 August 16th, 2006 09:38 AM
Nested Calculated Fields in Queries SerranoG Access 0 August 14th, 2006 10:04 AM
Storing Calculated Fields dearnne Access VBA 1 August 30th, 2004 10:54 AM
Summing the Results of Two Calculated Fields CloudNine Access 1 December 24th, 2003 12:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.