I'm just trying to make a cash till and something is wrong because when i try to execute it it just freezes. I think something is wrong with my loop, also i don't know how to refresh my sale total when i click clear order. It clears it but when i select more values it just adds on to the old price. Any suggestions would be greatly appreciated!

Option Explicit
Dim Cost As Currency

Private Sub CommandButton12_Click()
'assume Burger and Pop = 3.00
Cost = Cost + 3
TextBox1.Value = TextBox1.Value & vbNewLine & "Burger and Pop $3.00"
TextBox3.Value = Cost
TextBox4.Value = Cost
End Sub

Private Sub CommandButton13_Click()
 TextBox1.Text = ""
 TextBox2.Text = ""
 TextBox3.Text = ""
End Sub

Private Sub CommandButton14_Click()
'assume chocolate bar = .90
Cost = Cost + 0.9
TextBox1.Value = TextBox1.Value & vbNewLine & "Chocolate Bar $0.90"
TextBox3.Value = Cost
TextBox4.Value = Cost
End Sub

Private Sub CommandButton15_Click()
'assume hot dog = 1.25'
Cost = Cost + 1.25
TextBox1.Value = TextBox1.Value & vbNewLine & "Hot Dog $1.25"
TextBox3.Value = Cost
TextBox4.Value = Cost
End Sub

Private Sub CommandButton2_Click()
'assume burger = 2.25'
Cost = Cost + 2.25
TextBox1.Value = TextBox1.Value & vbNewLine & "Burger $2.25"
TextBox3.Value = Cost
TextBox4.Value = Cost
End Sub

Private Sub CommandButton3_Click()
'assume HotDog And Pop = 2.00
Cost = Cost + 2
TextBox1.Value = TextBox1.Value & vbNewLine & "HotDog and Pop $2.00"
TextBox3.Value = Cost
TextBox4.Value = Cost
End Sub

Private Sub CommandButton5_Click()
'assume cheese = .30
Dim cheese As Currency

cheese = MsgBox("Customer must have a burger or hotdog")
Cost = Cost + 0.3
TextBox1.Value = TextBox1.Value & vbNewLine & "cheese $.30"
TextBox3.Value = Cost
TextBox4.Value = Cost
End Sub

Private Sub CommandButton6_Click()
'assume Pop = .99'
Cost = Cost + 0.99

TextBox1.Value = TextBox1.Value & vbNewLine & "Pop $0.99"
TextBox3.Value = Cost
TextBox4.Value = Cost
End Sub

Private Sub CommandButton9_Click()
Dim AmtRec As Currency
Dim EndVal As Currency
Dim Change As Currency

AmtRec = InputBox("Money Recieved From Customer")
'display how much money was recieved
TextBox2.Value = TextBox2.Value & vbNewLine & "Amount Recieved: $" & AmtRec

Change = AmtRec - Cost
'display how much change is due
TextBox2.Value = TextBox2.Value & vbNewLine & "Change Due: $" & Change

'TextBox3.Value = Saletotal

'Find out how much is owed to customer

Do While Change >= 0
    If Change >= 10 Then
        EndVal = (10 - Cost)
        TextBox2.Value = TextBox2.Value & vbNewLine & "Change to Give Customer: $10.00"
        End If
     If Change >= 5 Then
        EndVal = (5 - Cost)
        TextBox2.Value = TextBox2.Value & vbNewLine & "Change to Give Customer: $5.00"
        End If
       If Change >= 2 Then
        EndVal = (2 - Cost)
        TextBox2.Value = TextBox2.Value & vbNewLine & "Change to Give Customer: $2.00"
        End If
         If Change >= 1 Then
        EndVal = (1 - Cost)
        TextBox2.Value = TextBox2.Value & vbNewLine & "Change to Give Customer: $1.00"
        End If
         If Change >= 0.25 Then
        EndVal = (0.25 - Cost)
        TextBox2.Value = TextBox2.Value & vbNewLine & "Change to Give Customer: $0.25"
        End If
         If Change >= 0.1 Then
       EndVal = (0.1 - Cost)
       TextBox2.Value = TextBox2.Value & vbNewLine & "Change to Give Customer: $0.10"
        End If
         If Change >= 0.05 Then
        EndVal = (0.05 - Cost)
        TextBox2.Value = TextBox2.Value & vbNewLine & "Change to Give Customer: $0.05"
        End If
         If Change >= 0.01 Then
        EndVal = (0.01 - Cost)
        TextBox2.Value = TextBox2.Value & vbNewLine & "Change to Give Customer: $0.01"
        End If
Loop
End
End Sub

Recommended Answers

All 3 Replies

I think you have many syntax errrors if you put that code to Python interpreter :)

its vb code in excel I didn't mean to put it under python, sorry! but if you could still help that'd be great!

syntax errors. avoid too much use of unnecessary procedures.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.