I have a form in Excel that records data, its is an Order Form. On this is a column for Price. I have a number of rows for creating a Description of Goods, Qty & Price. These are all as a Text Box. At the bottom is a Total Box, this is as a Label.
What I am trying to do is after the Text Boxes have had a value input is to calculate the Total Price as we go along. How do I get this to work?
This is what I have been doing....
Code:
Private Sub txtPrice1_AfterUpdate()
GetTotal
End Sub
Private Sub txtPrice2_AfterUpdate()
GetTotal
End Sub
Private Sub txtPrice3_AfterUpdate()
GetTotal
End Sub
Private Sub txtPrice4_AfterUpdate()
GetTotal
End Sub
Private Sub txtPrice5_AfterUpdate()
GetTotal
End Sub
Code:
Sub GetTotal()
TotalPrice.TotalCalc
Me.lblTotal = TotalPrice.IngTotalPrice
End Sub
Code:
Public IngTotalPrice As Long
Public TotalPriceCalc As Long
Sub calcTotalPrice()
If IsNumeric(usrFrmInputPO.txtPrice1) And IsNumeric(usrFrmInputPO.txtPrice2) And IsNumeric(usrFrmInputPO.txtPrice3) And IsNumeric(usrFrmInputPO.txtPrice4) And IsNumeric(usrFrmInputPO.txtPrice5) Then
TotalCalc
End If
End Sub
Sub TotalCalc()
IngTotalPrice = usrFrmInputPO.txtPrice1 + usrFrmInputPO.txtPrice2 + usrFrmInputPO.txtPrice3 + usrFrmInputPO.txtPrice4 + usrFrmInputPO.txtPrice5
End Sub
When I use that it tells me that there is a Type Mismatch as example if I've entered 5.00 or anything like a currency value. If I just enter a whole number like 5 then the lblTotal will still not add them up but just keep putting whatever is in the TextBoxes, eg 55555