hi, i have two continuous subforms on a main form. each of these subforms has a txtGrant textbox that totals up the values in the subform using a control source procedure.
on my main form i would like to add these two grant text boxes together using vba code. i can do it using the control source function, but feel if i do it in code then i can store the value as a global variable and thus use it somewhere else.
Should i do it this way or use the control source method? the code i have tried finds the value but is not passing the value to the variables, code below. why is this, it must be a simple error on my behalf!
Dim global_total As Double
Private Sub Form_Current()
Dim principle As Double
Dim provisional As Double
principle = (Nz(Me.sub_grant_calculation_form.Form!txtGrant))
provisional = (Nz(Me.sub_grant_provisional.Form!txtGrant))
global_total = principle + provisional
Me.txtTotalGrant.value = global_total
End Sub
on my main form i would like to add these two grant text boxes together using vba code. i can do it using the control source function, but feel if i do it in code then i can store the value as a global variable and thus use it somewhere else.
Should i do it this way or use the control source method? the code i have tried finds the value but is not passing the value to the variables, code below. why is this, it must be a simple error on my behalf!
Dim global_total As Double
Private Sub Form_Current()
Dim principle As Double
Dim provisional As Double
principle = (Nz(Me.sub_grant_calculation_form.Form!txtGrant))
provisional = (Nz(Me.sub_grant_provisional.Form!txtGrant))
global_total = principle + provisional
Me.txtTotalGrant.value = global_total
End Sub