Group:
I have a table that has two fields
1. Field Name "Factor" which can either have "$" or "%"
2. Field Name "Value" which is a Data Type = Double
I have a form that the user 1st selects the "$" or "%". Based on the selection in the cmboFactor, I want the "Value text box" to be masked or formatted accordingly. Since the data type is a double this should work for both currency and percentages . . . . right?
So I thought I would try the following:
Private Sub txtFactor_AfterUpdate()
If cmboFactor = "%" Then
Me![txtValue] = Format([txtValue], "0.00%")
ElseIf cmboFactor = "$" Then
Me![txtValue] = Format([txtValue], "$0.00")
End If
End Sub
It doesn't work? 2 questions:
1. Why doesn't this work even if the dataType is Double?
2. Would I be better off setting up the necessary fields for both currency and percentages and manage the data entry from the form into the proper field?
I have searched quite a bit to no avail. This leads me to believe that #2 is the better option?
Thanks!
Itch
I have a table that has two fields
1. Field Name "Factor" which can either have "$" or "%"
2. Field Name "Value" which is a Data Type = Double
I have a form that the user 1st selects the "$" or "%". Based on the selection in the cmboFactor, I want the "Value text box" to be masked or formatted accordingly. Since the data type is a double this should work for both currency and percentages . . . . right?
So I thought I would try the following:
Private Sub txtFactor_AfterUpdate()
If cmboFactor = "%" Then
Me![txtValue] = Format([txtValue], "0.00%")
ElseIf cmboFactor = "$" Then
Me![txtValue] = Format([txtValue], "$0.00")
End If
End Sub
It doesn't work? 2 questions:
1. Why doesn't this work even if the dataType is Double?
2. Would I be better off setting up the necessary fields for both currency and percentages and manage the data entry from the form into the proper field?
I have searched quite a bit to no avail. This leads me to believe that #2 is the better option?
Thanks!
Itch