Sub CalculateOrder()
On Error GoTo CalculateOrder_Error
Dim Part1UnitPrice As Double, Part1Quantity As Byte
Dim Part2UnitPrice As Double, Part2Quantity As Byte
Dim Part3UnitPrice As Double, Part3Quantity As Byte
Dim Part4UnitPrice As Double, Part4Quantity As Byte
Dim Part5UnitPrice As Double, Part5Quantity As Byte
Dim Part1SubTotal As Double
Dim Part2SubTotal As Double
Dim Part3SubTotal As Double
Dim Part4SubTotal As Double
Dim Part5SubTotal As Double
Dim JobPrice1 As Double
Dim JobPrice2 As Double
Dim JobPrice3 As Double
Dim JobPrice4 As Double
Dim JobPrice5 As Double
Dim TotalParts As Double
Dim TotalLabor As Currency
Dim TaxRate As Double
Dim TaxAmount As Currency
Dim RepairTotal As Currency
'get the unit price from the text boxes
Part1UnitPrice = txtPart1UnitPrice
Part2UnitPrice = txtPart2UnitPrice
Part3UnitPrice = txtPart3UnitPrice
Part4UnitPrice = txtPart4UnitPrice
Part5UnitPrice = txtPart5UnitPrice
'get the Qty from the text boxes
Part1Quantity = txtPart1Quantity
Part2Quantity = txtPart2Quantity
Part3Quantity = txtPart3Quantity
Part4Quantity = txtPart4Quantity
Part5Quantity = txtPart5Quantity
'calculate the subtotals
Part1SubTotal = Part1UnitPrice * Part1Quantity
Part2SubTotal = Part2UnitPrice * Part1Quantity
Part3SubTotal = Part3UnitPrice * Part3Quantity
Part4SubTotal = Part4UnitPrice * Part4Quantity
Part5SubTotal = Part5UnitPrice * Part5Quantity
'put the subtotals in proper textboxes
txtPart1SubTotal = Part1SubTotal
txtPart2SubTotal = Part2SubTotal
txtPart3SubTotal = Part3SubTotal
txtPart4SubTotal = Part4SubTotal
txtPart5SubTotal = Part5SubTotal
'total up parts
TotalParts = CCur(Part1SubTotal + Part2SubTotal + Part3SubTotal + Part4SubTotal + Part5SubTotal)
'obtain the labor cost
JobPrice1 = txtJobPrice1
JobPrice2 = txtJobPrice2
JobPrice3 = txtJobPrice3
JobPrice4 = txtJobPrice4
JobPrice5 = txtJobPrice5
'calculate total labor
TotalLabor = CCur(JobPrice1 + JobPrice2 + JobPrice3 + JobPrice4 + JobPrice5)
'get the taxrate
TaxRate = txtTaxRate
TaxAmount = (TotalLabor + TotalParts) * (TaxRate / 100)
RepairTotal = TotalLabor + TotalParts + TaxAmount
'show the results
txtRepairTotal = RepairTotal
txtTaxAmount = TaxAmount
txtTotalLabor = TotalLabor
txtTotalParts = TotalParts
'End Sub
'If there is a problem address it here
CalculateOrder_Error:
If Error = 94 Then
MsgBox "Make sure you enter the proper format" & vbCrLf & "Try Again!"
End If
End Sub