I am having some problem with my code checking if the amount that was entered by the cashier is less than the total that is subtracted from.
Here is my code:
Dim Change, LooseChange As Currency
Dim getLooseChange As Boolean
If txtDigits = "$" Or txtDigits = "" Then
MsgBox "Your need to enter an amount first", vbInformation
If getLooseChange = True Then
Change = Val(txtDigits.Text - LooseChange)
Text1 = Change
Change = Val(txtDigits.Text - lblTaxTotal)
If Left(Change, 1) = "-" Then
MsgBox "You need " & Replace(Change, "-", "") & " more to complete this transaction", vbCritical
getLooseChange = True
LooseChange = Replace(Change, "-", "")
getLooseChange = False
txtDigits is the box where the cashier types the amout of money the customer gives to them.
lblTaxTotal is the total amount of the products the customer bought.
Change is the amount the customer bought (lblTaxTotal) minus the amout of money the customer gave to the cashier (txtDigits).
Now it calculates just fine. But once its a negitive number... it tells the cashier that you need XX more to finish the transaction. The getLooseChange doesnt seem to work. Its always false for some reason.
This is where i am stuck. How can i check AGAIN the amount of money the cashier types in the txtDigits box after the amount is needed and again check for a negitive number? I also need it to give change back if the second time around they gave so much over the amout that was due.
Thanks for your time,