S
Steve S
I need to update a field (textbox) on several very similar forms. To reduce
the amount of code and to preclude having duplicate code to do the
calculations in each form I want to use a subroutine to perform the
calculations.
I want to call the subroutine with several parameters and have it return the
result directly to the form. A very stripped down (simplified) sample is
shown below. Text4 is the field I want to update
Private Sub Command6_Click()
subTestCall 2, 3, Me.Text4
MsgBox Me.Text4
End Sub
--------------------------------------------------------------------------
Public Sub subTestCall(varA As Byte, varB As Byte, ByRef varC As Byte)
varC = varA + varB
MsgBox varC
End Sub
---------------------------------------------------------------------
MsgBox varC shows a value of 5 as expected
But MsgBox Me.Text4 shows that Text4 still contains 1 which is the initial
value of Text4 before the call.
What do I have to do to get Text4 to update via the returned parameter in
the call??
the amount of code and to preclude having duplicate code to do the
calculations in each form I want to use a subroutine to perform the
calculations.
I want to call the subroutine with several parameters and have it return the
result directly to the form. A very stripped down (simplified) sample is
shown below. Text4 is the field I want to update
Private Sub Command6_Click()
subTestCall 2, 3, Me.Text4
MsgBox Me.Text4
End Sub
--------------------------------------------------------------------------
Public Sub subTestCall(varA As Byte, varB As Byte, ByRef varC As Byte)
varC = varA + varB
MsgBox varC
End Sub
---------------------------------------------------------------------
MsgBox varC shows a value of 5 as expected
But MsgBox Me.Text4 shows that Text4 still contains 1 which is the initial
value of Text4 before the call.
What do I have to do to get Text4 to update via the returned parameter in
the call??