calculation

loki

Registered User.
Local time
Today, 21:00
Joined
May 4, 2001
Messages
58
I have three fields on a form and the same three are stored in the table. There is
1)Actual
2)Estimated
3)Estimated time to complete

I want to put times in the first two text boxes and in the third box I want the value of ([Estimated]-[Actual])to appear. The value that appears in this third text boxes, has to be stored in the table. If I use the control source property, how do I do the calculation and store the value in the table.
 
Loki,
You could do it this way, its a little more rinky-dinky, but it gets the job done:

Instead of having the third field [Estimated time to complete] as the box that preforms the calculation why not use and unbound text box to do this, for example we'll call it [calcbox].
Write your equation: ([Estimated]-[Actual]) in the control source for the unbound txtbox. Then in the afterupdate event on this box have a code to write this value to your linked field [Estimated time to complete], with the code:

Private Sub calcbox_afterupdate(Cancel As Integer)
Me.estimated time to complete = Me.calcbox
End Sub

Set the visibility prop on the [estimated-complete] box to no. This way once the calculation is preformed the value will be written to the table.

HTH,
Kevin
 
Why do you have to store a calculated field in your table?
 
it was requested that way,

I think I found a solution anyway.

On the change event of [Actual] I made
[Estimate to Coplete]= [estimated]-[actual]then I just left the control source of [estimste to complete] linked to the table.

Thanks for responding
 

Users who are viewing this thread

Back
Top Bottom