Could Tom or one of the other VB gurus here look at this code and tell me whats wrong.
I just cant get it to work.
Private Sub cmdQUIT_Click()
'Terminate Application
End
End Sub
Private Sub cmdStart_Click()
'Declare required storage
Dim Result As Currency
Dim PenceResult As Currency
Dim Required As Currency
Dim Payment As Currency
'Ask user to input required amount
Required = InputBox("Please input the cost amount ", "Cost Amount")
Payment = InputBox("Please input the amount paid ", "Amount Paid")
Result = Payment - Required
'put pounds into pence
PenceResult = Result * 100
'£5 notes
X = PenceResult Mod 500
If Result > 0 Then
picMessage.Print X & " £5 notes in change"
PenceResult = PenceResult - (X * 500)
End If
'£2 coins
X = PenceResult Mod 200
If Result > 0 Then
picMessage.Print X & " £2 coins in change"
PenceResult = PenceResult - (X * 200)
End If
'£1 coins
X = PenceResult Mod 100
If Result > 0 Then
picMessage.Print X & " £1 coins in change"
PenceResult = PenceResult - (X * 100)
End If
'50p coins
X = PenceResult Mod 50
If Result > 0 Then
picMessage.Print X & " 50p coins in change"
PenceResult = PenceResult - (X * 50)
End If
'20p coins
X = PenceResult Mod 20
If Result > 0 Then
picMessage.Print X & " 20p coins in change"
PenceResult = PenceResult - (X * 20)
End If
'10p Coins
X = PenceResult Mod 10
If Result > 0 Then
picMessage.Print X & " 10p coins in change"
PenceResult = PenceResult - (X * 10)
End If
'5p Coins
X = PenceResult Mod 5
If Result > 0 Then
picMessage.Print X & " 5p coins in change"
PenceResult = PenceResult - (X * 5)
End If
'2p Coins
X = PenceResult Mod 2
If Result > 0 Then
picMessage.Print X & " 2p coins in change"
PenceResult = PenceResult - (X * 2)
End If
'1p Coins
X = PenceResult Mod 1
If Result > 0 Then
picMessage.Print X & " 1p coins in change"
PenceResult = PenceResult - (X * 1)
End If
End Sub
Cheers
Charlie
I just cant get it to work.
Private Sub cmdQUIT_Click()
'Terminate Application
End
End Sub
Private Sub cmdStart_Click()
'Declare required storage
Dim Result As Currency
Dim PenceResult As Currency
Dim Required As Currency
Dim Payment As Currency
'Ask user to input required amount
Required = InputBox("Please input the cost amount ", "Cost Amount")
Payment = InputBox("Please input the amount paid ", "Amount Paid")
Result = Payment - Required
'put pounds into pence
PenceResult = Result * 100
'£5 notes
X = PenceResult Mod 500
If Result > 0 Then
picMessage.Print X & " £5 notes in change"
PenceResult = PenceResult - (X * 500)
End If
'£2 coins
X = PenceResult Mod 200
If Result > 0 Then
picMessage.Print X & " £2 coins in change"
PenceResult = PenceResult - (X * 200)
End If
'£1 coins
X = PenceResult Mod 100
If Result > 0 Then
picMessage.Print X & " £1 coins in change"
PenceResult = PenceResult - (X * 100)
End If
'50p coins
X = PenceResult Mod 50
If Result > 0 Then
picMessage.Print X & " 50p coins in change"
PenceResult = PenceResult - (X * 50)
End If
'20p coins
X = PenceResult Mod 20
If Result > 0 Then
picMessage.Print X & " 20p coins in change"
PenceResult = PenceResult - (X * 20)
End If
'10p Coins
X = PenceResult Mod 10
If Result > 0 Then
picMessage.Print X & " 10p coins in change"
PenceResult = PenceResult - (X * 10)
End If
'5p Coins
X = PenceResult Mod 5
If Result > 0 Then
picMessage.Print X & " 5p coins in change"
PenceResult = PenceResult - (X * 5)
End If
'2p Coins
X = PenceResult Mod 2
If Result > 0 Then
picMessage.Print X & " 2p coins in change"
PenceResult = PenceResult - (X * 2)
End If
'1p Coins
X = PenceResult Mod 1
If Result > 0 Then
picMessage.Print X & " 1p coins in change"
PenceResult = PenceResult - (X * 1)
End If
End Sub
Cheers
Charlie