03856me
Active Member
- Joined
- Apr 4, 2008
- Messages
- 297
I have a userform that totals two input boxes which are formatting with no problem to include the commas. I have searched your site for help with this and could only find formatting of individual textboxes and not one that is totaled.
Example of problem:
1,000,000 value of txt_hem
2,000,000 value of txt_fir
3 value of txt_total
I am including my code, can someone help me figure out why the total is not formatting as 3,000,000
thank you so much,
"Exhausted and confused"
'============================================================
'MACROS TO TOTAL INVENTORY
'============================================================
Private Sub InventoryTotal()
Dim InventoryTotal As Double
InventoryTotal = Val(Me.txt_hem) + Val(Me.txt_fir)
Me.txt_total = InventoryTotal
End Sub
Private Sub txt_hem_Change()
InventoryTotal
End Sub
Private Sub txt_fir_Change()
InventoryTotal
End Sub
'============================================================
'MACROS TO FORMAT TEXTBOXES
'============================================================
Private Sub txt_hem_AfterUpdate()
txt_hem.Value = Format(txt_hem.Value, "#,###,###")
End Sub
Private Sub txt_fir_AfterUpdate()
txt_fir.Value = Format(txt_fir.Value, "#,###,###")
End Sub
Private Sub txt_total_AfterUpdate()
txt_total.Value = Format(txt_total.Value, "#,###,###")
End Sub
Example of problem:
1,000,000 value of txt_hem
2,000,000 value of txt_fir
3 value of txt_total
I am including my code, can someone help me figure out why the total is not formatting as 3,000,000
thank you so much,
"Exhausted and confused"
'============================================================
'MACROS TO TOTAL INVENTORY
'============================================================
Private Sub InventoryTotal()
Dim InventoryTotal As Double
InventoryTotal = Val(Me.txt_hem) + Val(Me.txt_fir)
Me.txt_total = InventoryTotal
End Sub
Private Sub txt_hem_Change()
InventoryTotal
End Sub
Private Sub txt_fir_Change()
InventoryTotal
End Sub
'============================================================
'MACROS TO FORMAT TEXTBOXES
'============================================================
Private Sub txt_hem_AfterUpdate()
txt_hem.Value = Format(txt_hem.Value, "#,###,###")
End Sub
Private Sub txt_fir_AfterUpdate()
txt_fir.Value = Format(txt_fir.Value, "#,###,###")
End Sub
Private Sub txt_total_AfterUpdate()
txt_total.Value = Format(txt_total.Value, "#,###,###")
End Sub