I have 5 text boxes that I want to total up in a 6th text box. The first 5 are formatted as such, upon initialization of the form.
When I test the form, the default value of 0 is presented as I want it to be, as in $0.00. Now, I've googled a bunch, and watched a couple of YouTube videos on how to sum. Here's what seems to be working as far as summing, but I can't seem to be able to keep the formatting in all 6 text boxes.
Any suggestions?
Code:
Me.txt_DPPaid = Format(0, "$#,##0.00")
When I test the form, the default value of 0 is presented as I want it to be, as in $0.00. Now, I've googled a bunch, and watched a couple of YouTube videos on how to sum. Here's what seems to be working as far as summing, but I can't seem to be able to keep the formatting in all 6 text boxes.
Code:
Private Sub txt_DPPaid_Change()'Me.txt_DPPaid = Format(Me.txt_DPPaid, "$#,##0.00") - this is only taking the first number I type in, and then only progressing by 1 cent
'Me.txt_DPPaid = CCur(Me.txt_DPPaid) - this actually removes the formatting.
Call SumTotalPaid
End Sub
Private Sub SumTotalPaid()
On Error Resume Next
'Me.txt_TotalPaid = (Me.txt_DPPaid + 0) + (Me.txt_DCPaid + 0) + (Me.txt_OCPaid + 0) + (Me.txt_CTIPaid + 0) + (Me.txt_CTOPaid + 0)
Me.txt_TotalPaid = (IIf(Me.txt_DPPaid = 0, 0, Me.txt_DPPaid) + (IIf(Me.txt_DCPaid = 0, 0, Me.txt_DCPaid) + (IIf(Me.txt_OCPaid = 0, 0, Me.txt_OCPaid) _
+ (IIf(Me.txt_CTIPaid = 0, 0, Me.txt_CTIPaid) + (IIf(Me.txt_CTOPaid = 0, 0, Me.txt_CTOPaid))))))
Me.txt_TotalPaid = Format(Me.txt_TotalPaid, "$#,##0.00")
End Sub
Any suggestions?