i am working on a tax program. i write the following code in the OnUpdate Event of a text field.
Private Sub Combo232_AfterUpdate()
If ([sex] = "MALE" And [total_income] > 110000 And [total_income] <= 150000) Then
Me.taxOnIncome = (([total_income] - 110000) * 10 / 100)
Else
Me.taxOnIncome = 0
End If
If ([sex] = "MALE" And [total_income] > 150000 And [total_income] <= 250000) Then
Me.taxOnIncome = (([total_income] - 150000) * 20 / 100) + 4000
Else
If ([sex] = "MALE" And [total_income] > 250000) Then
Me.taxOnIncome = (([total_income] - 250000) * 30 / 100) + 24000
End If
End If
If ([sex] = "FEMALE" And [total_income] > 145000 And [total_income] <= 150000) Then
Me.taxOnIncome = (([total_income] - 145000) * 10 / 100)
Else
Me.taxOnIncome = 0
End If
If ([sex] = "FEMALE" And [total_income] > 150000 And [total_income] <= 250000) Then
Me.taxOnIncome = (([total_income] - 150000) * 20 / 100) + 500
Else
If ([sex] = "FEMALE" And [total_income] > 250000) Then
Me.taxOnIncome = (([total_income] - 250000) * 30 / 100) + 20500
End If
End If
If ([sex] = "SR. CITIZEN" And [total_income] > 195000 And [total_income] <= 250000) Then
Me.taxOnIncome = (([total_income] - 195000) * 20 / 100)
Else
Me.taxOnIncome = 0
End If
If ([sex] = "SR. CITIZEN" And [total_income] > 250000) Then
Me.taxOnIncome = (([total_income] - 250000) * 30 / 100) + 11000
End If
my problem is that after completing this prog, it calculates the result only for the last part i.e. Sr. Citizen. but when i remove the "Sr. Citezen" part then it gives the results only for "Women " part. But when i remove both "women" and "Sr. citezen" part then it gives results for "Male" part.
I want all these 3 fields working. Please help me.
Private Sub Combo232_AfterUpdate()
If ([sex] = "MALE" And [total_income] > 110000 And [total_income] <= 150000) Then
Me.taxOnIncome = (([total_income] - 110000) * 10 / 100)
Else
Me.taxOnIncome = 0
End If
If ([sex] = "MALE" And [total_income] > 150000 And [total_income] <= 250000) Then
Me.taxOnIncome = (([total_income] - 150000) * 20 / 100) + 4000
Else
If ([sex] = "MALE" And [total_income] > 250000) Then
Me.taxOnIncome = (([total_income] - 250000) * 30 / 100) + 24000
End If
End If
If ([sex] = "FEMALE" And [total_income] > 145000 And [total_income] <= 150000) Then
Me.taxOnIncome = (([total_income] - 145000) * 10 / 100)
Else
Me.taxOnIncome = 0
End If
If ([sex] = "FEMALE" And [total_income] > 150000 And [total_income] <= 250000) Then
Me.taxOnIncome = (([total_income] - 150000) * 20 / 100) + 500
Else
If ([sex] = "FEMALE" And [total_income] > 250000) Then
Me.taxOnIncome = (([total_income] - 250000) * 30 / 100) + 20500
End If
End If
If ([sex] = "SR. CITIZEN" And [total_income] > 195000 And [total_income] <= 250000) Then
Me.taxOnIncome = (([total_income] - 195000) * 20 / 100)
Else
Me.taxOnIncome = 0
End If
If ([sex] = "SR. CITIZEN" And [total_income] > 250000) Then
Me.taxOnIncome = (([total_income] - 250000) * 30 / 100) + 11000
End If
my problem is that after completing this prog, it calculates the result only for the last part i.e. Sr. Citizen. but when i remove the "Sr. Citezen" part then it gives the results only for "Women " part. But when i remove both "women" and "Sr. citezen" part then it gives results for "Male" part.
I want all these 3 fields working. Please help me.