Solved
percentages
Posted on 2002-03-27
Percentages
i have an order type system where a user enters in a product number
and it searches the database for that product and displays its
description and unit price, which works ok, but i am trying to
calculate the total as well as working out the discount
there is TWO problems
1. not all customers get discount so i keep getting an error
saying not divisible by zero if i enter "0" into the discount
textbox
2. How can i get the percentage equation working where it automatically
works out the percentage discount taken off the total
Private Sub txtTotal_Change(Index As Integer)
If IsNumeric(txtUnitPrice(Index)) And IsNumeric(txtQuantity(Index)) And Val(txtDiscount(Index)) > 0 Then
calculate = Val(txtUnitPrice(Index)) * Val(txtQuantity(Index)) + Val(txtDiscount(Index) / 100) * Val(txtTotal(Index))
txtTotal(Index).Text = calculate
End If
End Sub
PLEASE help
cheers