tech4ultimate
Technical User
I have 3 text boxes on my form.labeled as follows
Amount($) , Rate(%) and Returns($).By goal is to automatically display a value in the third box after any of the other two boxes are updated.
For example if Amount has 100 and Rate is 25 then 125 will display in Returns.My goal is to be able to get the correct results irrespective of the order in which the boxes are updated so if i updated Rate with 25 then Returns with 125 Amount should display 100.
My coding only works if my update begins with Rate if any other box is updated first they all return a null value.
Much appreciation for any help received.
Below is the code i am using:
Private Sub Amount_AfterUpdate()
[Rate] = ([Returns] - [Amount]) / (0.01 * [Amount])
[Returns] = [Amount] + (0.01 * [Rate] * [Amount])
End Sub
Private Sub cmdClear_Click()
[Rate] = Null
[Returns] = Null
[Amount] = Null
End Sub
Private Sub Form_Load()
[Rate] = Null
[Returns] = Null
[Amount] = Null
End Sub
Private Sub Rate_AfterUpdate()
[Returns] = [Amount] + (0.01 * [Rate] * [Amount])
[Amount] = [Returns] - (0.01 * [Rate] * [Amount])
End Sub
Private Sub Returns_AfterUpdate()
[Rate] = ([Returns] - [Amount]) / (0.01 * [Amount])
[Amount] = [Returns] - (0.01 * [Rate] * [Amount])
End Sub
Amount($) , Rate(%) and Returns($).By goal is to automatically display a value in the third box after any of the other two boxes are updated.
For example if Amount has 100 and Rate is 25 then 125 will display in Returns.My goal is to be able to get the correct results irrespective of the order in which the boxes are updated so if i updated Rate with 25 then Returns with 125 Amount should display 100.
My coding only works if my update begins with Rate if any other box is updated first they all return a null value.
Much appreciation for any help received.
Below is the code i am using:
Private Sub Amount_AfterUpdate()
[Rate] = ([Returns] - [Amount]) / (0.01 * [Amount])
[Returns] = [Amount] + (0.01 * [Rate] * [Amount])
End Sub
Private Sub cmdClear_Click()
[Rate] = Null
[Returns] = Null
[Amount] = Null
End Sub
Private Sub Form_Load()
[Rate] = Null
[Returns] = Null
[Amount] = Null
End Sub
Private Sub Rate_AfterUpdate()
[Returns] = [Amount] + (0.01 * [Rate] * [Amount])
[Amount] = [Returns] - (0.01 * [Rate] * [Amount])
End Sub
Private Sub Returns_AfterUpdate()
[Rate] = ([Returns] - [Amount]) / (0.01 * [Amount])
[Amount] = [Returns] - (0.01 * [Rate] * [Amount])
End Sub