A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

storing calculated values from forms into a database file



 
 
Thread Tools Display Modes
  #1  
Old October 1st, 2009, 03:09 AM posted to microsoft.public.access.gettingstarted
snimmuc
external usenet poster
 
Posts: 6
Default storing calculated values from forms into a database file

I am new to Access. I have created a form with a calculated field. All other
data from the form stores OK back into the Database, BUT the calculated field
will not store in the database. The calculated field stores OK into the split
screen version of the form layout. Your help Please. I am using Access 2007
  #2  
Old October 1st, 2009, 03:23 AM posted to microsoft.public.access.gettingstarted
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default storing calculated values from forms into a database file

"snimmuc" wrote in message
...
I am new to Access. I have created a form with a calculated field. All
other
data from the form stores OK back into the Database, BUT the calculated
field
will not store in the database. The calculated field stores OK into the
split
screen version of the form layout. Your help Please. I am using Access
2007


Access saved you from making a mistake in database design. Unless you need
history, and are not storing the elements of the calculation, you should
never store the results of a calculation. Forms do not store data, they
allow entry and display.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


  #3  
Old October 1st, 2009, 12:48 PM posted to microsoft.public.access.gettingstarted
KenSheridan via AccessMonster.com
external usenet poster
 
Posts: 1,610
Default storing calculated values from forms into a database file

Whether you should store a derived value or not in a column in the table
depends on the scenario:

1. If the computed value can always be derived from other stored values, and
should consequently change if they change, then don't store it. For
example in an OrderDetails table you might compute a total price with
[UnitPrice] * [Quantity]. The total price should not be stored in this case
as it will always reflect the UnitPrice and Quantity values stored in other
columns. It should be shown in an unbound computed control on a from or
report, or in a computed column in a query.

2. In the same OrderDetails table you might look up the UnitPrice of the
selected product from a Products table. In this case if you did not store
the price in the OrderDetails table, as the price in products changes over
time the price in each order would be changed. You would not want that to
happen as the price in the order should remain static as that current when
the order was created. In this case you would not use an unbound control for
UnitPrice but a bound control and assign the value looked up from Products to
it. You'll find an example in the sample Northwind database's Orders Subform,
where code in the AfterUpdate event procedure of the ProductID control
assigns the value to the bound UnitPrice control as follows:

Dim strFilter As String

' Evaluate filter before it's passed to DLookup function.
strFilter = "ProductID = " & Me!ProductID

' Look up product's unit price and assign it to UnitPrice control.
Me!UnitPrice = DLookup("UnitPrice", "Products", strFilter)

Ken Sheridan
Stafford, England

snimmuc wrote:
I am new to Access. I have created a form with a calculated field. All other
data from the form stores OK back into the Database, BUT the calculated field
will not store in the database. The calculated field stores OK into the split
screen version of the form layout. Your help Please. I am using Access 2007


--
Message posted via http://www.accessmonster.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:29 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.