Is there a way to simplify this coding?
VBA Code:
Private Sub txtAmount1_AfterUpdate()
Dim txt As Object
Set txt = Me.txtAmount1
With txt
If IsNumeric(.Value) Then .Value = Format(.Value, "#,##0.00")
If txt.Value = "" Then txt.Value = "0.00"
End With
End Sub
Private Sub txtAmount2_AfterUpdate()
Dim txt As Object
Set txt = Me.txtAmount2
With txt
If IsNumeric(.Value) Then .Value = Format(.Value, "#,##0.00")
If txt.Value = "" Then txt.Value = "0.00"
End With
End Sub
Private Sub txtAmount3_AfterUpdate()
Dim txt As Object
Set txt = Me.txtAmount3
With txt
If IsNumeric(.Value) Then .Value = Format(.Value, "#,##0.00")
If txt.Value = "" Then txt.Value = "0.00"
End With
End Sub
Private Sub txtAmount4_AfterUpdate()
Dim txt As Object
Set txt = Me.txtAmount4
With txt
If IsNumeric(.Value) Then .Value = Format(.Value, "#,##0.00")
If txt.Value = "" Then txt.Value = "0.00"
End With
End Sub
Private Sub txtAmount5_AfterUpdate()
Dim txt As Object
Set txt = Me.txtAmount5
With txt
If IsNumeric(.Value) Then .Value = Format(.Value, "#,##0.00")
If txt.Value = "" Then txt.Value = "0.00"
End With
End Sub