tags:

views:

30

answers:

2

I have two bound textbox and one unbound on a form the first textbox is named 150 the second one is 190 and the third is called 150-190, the third one is the unbound. now the user inputs a time on the first and second textbox and the third textbox substract the value from the textbox 190 from the textbox 150 and it's working fine but where I have problem is that I can not save the information from the third texbox to a table since the control source is set two the first two textbox, I already have a field on my table named result which is where I want to save the information from the third textbox. Any help will be appreciated and I hope that I'm making sense.

I really appreciate your help guys, I'm new to access and I'm just barely starting to use it, I'll try bob the destroyer solution and see what happens but on which of the event should I try it, on the Before Update or the After Update.

+3  A: 

It is against normalization rules to store the results of a calculation, it can be done, but do you really need it? The calculation can always be shown in a query (view).

Remou
A: 

Bind control # 3 to a table field as normal. Set the onupdate properties of the first two controls to perform the calculation and assign the value to control # 3 ([control_3].value = [control_1].value - [control_2].value or some other formula you wish as onupdate property for both controls # 1 and 2).

As Remou suggested, you should never rely on the value of this results field as it could always be changed elsewhere independently of these two other fields using some other form or direct table access.

bob-the-destroyer
A2010 adds two features that change this equation in terms of consistency. One is table-level data macros that allow you to create the equivalent of triggers that would keep the derived field up-to-date when the source fields are updated. The other is that you can create calculated fields in the table definitions, and the results are stored and indexable (particularly useful when you do need to query the results of calculations). Whether or not either of these is a good idea depends on the circumstances -- in most cases, you won't want to store calculations.
David-W-Fenton
@David-W-Fenton: good to know. Thanks.
bob-the-destroyer
i really appreciate your help guys, I'm new to access and I'm just barely starting to use it, I'll try bob the destroyer solution and see what happens but on which of the event should I try it, on the Before Update or the After Update.
nahun
@nahun: "after update" event.
bob-the-destroyer