Hey Chuxtable
It seems I missed the first few lines of code when I pasted it into the message. Sorry about that. Hopefully it resolves your issue.
Sub SumFunction
Dim objControl, objPage, GWDepth, WaterColumnThickness
Set objControl = ThisEvent.Object
Set objPage = ThisEvent.Object.Parent
GWDepth = objControl.Value
WaterColumnThickness = objPage.Controls("txtWell_Dep_TOC").Value - GWDepth
objPage.Controls("txtWat_Column").Value = WaterColumnThickness
End Sub
I have also added some additional code to populate a few more fields on my form. Hopefully you can use these as well.
Sub SumFunction
Dim objControl, objPage, GWDepth, WaterColumnThickness, GroundwaterElevation, CasingVolume
Set objControl = ThisEvent.Object
Set objPage = ThisEvent.Object.Parent
'Calculates water column thickness
GWDepth = objControl.Value
WaterColumnThickness = objPage.Controls("txtWell_Dep_TOC").Value - GWDepth
objPage.Controls("txtWat_Column").Value = WaterColumnThickness
'Calculates groundwater elevation
GWDepth = objControl.Value
GroundwaterElevation = objPage.Controls("txtWellElevation").Value - GWDepth
objPage.Controls("txtGWElevation").Value = GroundwaterElevation
'Calculates casing volume based on well casing diameter
GWDepth = objControl.Value
If objPage.Controls("txtCasDiameter").Value = 1 then
CasingVolume = objPage.Controls("txtWat_Column").Value * 0.04
Elseif objPage.Controls("txtCasDiameter").Value = 2 then
CasingVolume = objPage.Controls("txtWat_Column").Value * 0.16
Elseif objPage.Controls("txtCasDiameter").Value = 4 then
CasingVolume = objPage.Controls("txtWat_Column").Value * 0.65
Elseif objPage.Controls("txtCasDiameter").Value = 6 then
CasingVolume = objPage.Controls("txtWat_Column").Value * 1.47
Elseif objPage.Controls("txtCasDiameter").Value = 8 then
CasingVolume = objPage.Controls("txtWat_Column").Value * 10.1
End if
objPage.Controls("txtCasVolume").Value = CasingVolume
End Sub
These are all run in the onchange event in my GW Depth control
later,
JC