taniadimitri
Registered User.
- Local time
- Today, 01:48
- Joined
- Mar 13, 2007
- Messages
- 17
I have the following code in aform,
Private Sub Sales_App_Value_AfterUpdate()
Dim X As double
X = (me.comp1_AdjPrice + me.comp2_AdjPrice + me.comp3_AdjPrice + me.comp4_AdjPrice + me.comp5_AdjPrice + me.comp6_AdjPrice) / 6.0
If me.Sales_App_Value >= 2 * X / 3 And me.Sales_App_Value <= X Then
me.Value_Range = "upper 1/3"
ElseIf me.Sales_App_Value <= 2 * X / 3 And me.Sales_App_Value >= X / 3 Then
me.Value_Range = "middle 1/3"
ElseIf me.Sales_App_Value > 0 And me.Sales_App_Value <= X / 3 Then
me.Value_Range = "lower 1/3"
Else
me.Value_Range = "exceeded value"
end if
End Sub
Private Sub form_current()
Call Sales_App_Value_AfterUpdate
End Sub
I was trying to make 'value_range' field auto compute based on 'sales_app_value'. With the above code no value is computed and my database is getting corrupted . I am not sure why this is happening. Please suggest if there are errors in my approach. Is at all possible to make this field auto compute.
I am also attaching the screen shot of my form.
Thanks,
Private Sub Sales_App_Value_AfterUpdate()
Dim X As double
X = (me.comp1_AdjPrice + me.comp2_AdjPrice + me.comp3_AdjPrice + me.comp4_AdjPrice + me.comp5_AdjPrice + me.comp6_AdjPrice) / 6.0
If me.Sales_App_Value >= 2 * X / 3 And me.Sales_App_Value <= X Then
me.Value_Range = "upper 1/3"
ElseIf me.Sales_App_Value <= 2 * X / 3 And me.Sales_App_Value >= X / 3 Then
me.Value_Range = "middle 1/3"
ElseIf me.Sales_App_Value > 0 And me.Sales_App_Value <= X / 3 Then
me.Value_Range = "lower 1/3"
Else
me.Value_Range = "exceeded value"
end if
End Sub
Private Sub form_current()
Call Sales_App_Value_AfterUpdate
End Sub
I was trying to make 'value_range' field auto compute based on 'sales_app_value'. With the above code no value is computed and my database is getting corrupted . I am not sure why this is happening. Please suggest if there are errors in my approach. Is at all possible to make this field auto compute.
I am also attaching the screen shot of my form.
Thanks,