Update calculated field

deb

Active Member
Joined
Feb 1, 2003
Messages
400
Access 2013
Main form called fReqWBS with a checkbox called SiteinIowa.
Continuous sub form called fReqWBSLabor

Field in sub form called CosEstimate, it is calculated after the Hours field is updated...
Private Sub Hours_Afterupdate()
If Forms!fReqWBS.SiteinIowa =True Then
Me.CostEdtimate = round(Me.hours * Me.RateIowa, 2)
Else
Me.CostEdtimate = round(Me.hours * Me.Rate, 2)
End if
End sub

If users enter data and the CostEdtimate is calculated, it does not update the records if the user checks the SiteinIowa box. How can I get it to update the CostEstimate when the box is checked.?
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
You could add the same code to the AfterUpdate event of the SiteinIowa checkbox too.

If CostEdtimate a bound field (bound to an underlying table field)? Typically, you do not want to store anything that can be calculated.
Tpyically, I prefer to do all these type of calculations in a calculated field in a query, and then use the Query as the source of my Form.
 
Upvote 0
You could add the same code to the AfterUpdate event of the SiteinIowa checkbox too.

If CostEdtimate a bound field (bound to an underlying table field)? Typically, you do not want to store anything that can be calculated.
Tpyically, I prefer to do all these type of calculations in a calculated field in a query, and then use the Query as the source of my Form.



Thanks, I wanted it in the table for history purposes, I will go back to the drawing board
 
Upvote 0
Thanks, I wanted it in the table for history purposes, I will go back to the drawing board
That actually is one of the exceptions of when you might actually store calculations, although you may want to also consider just saving the rates (and included dates for when those rates were effective). You will probably end up saving a lot less data if you just store the historical rate table instead of saving everyone's historical calculations.
 
Upvote 0

Forum statistics

Threads
1,215,717
Messages
6,126,422
Members
449,314
Latest member
MrSabo83

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top