I have a textbox (in this instance it is textbox11) where the front end user will need to input "Half Day" in some form or another.
Here is my code:
Private Sub TextBox11_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
If Me.TextBox11 = "half" Or Me.TextBox11 = "half day" Or Me.TextBox11 = "half-day" Or Me.TextBox11 = 0.5 Or Me.TextBox11 = "1/2" Then
Me.TextBox11 = "Half Day"
End If
End Sub
When I run it, it works wonderfully - for the conditions I have set. However, if a user, say, inputs "hALf dAy", then this will not be validated and fixed to standard form as it is not on my condition list.
There is noway where I could put all permutations of what a user might put in. Is there a way to make this case-insensitive? So no matter what case a user puts in, it will check against my conditions anyway.
Thanks
LCasethe user input, but if you really want validation the best option is to use aComboBoxwith predefined values rather than a text box where the user can type any ol' garbage.Lcase(Me.TextBox11.Text)and compare it to the (already lower-cased) text strings of allowed values, like"half". By converting all characters to lower case, and then comparing to your lower-case strings, you are effectively case-insensitive.