help with Foematting uppercase
I use this - sInput2 = UCase(Mid(sInput2, 1, 1)) + LCase(Mid(sInput2, 2)) to force upercase on first two characters of text in customer number eg db1234 to go DB1234
Does any one know how to force input like new york to force the N and Y to uppercase. N is ease but I can't managed the one after a space. Also how to force after a .
Lots of people not inputing data corectly
Much apreciated
Re: help with Foematting uppercase
Quote:
Originally Posted by RayComp
I use this - sInput2 = UCase(Mid(sInput2, 1, 1)) + LCase(Mid(sInput2, 2)) to force upercase on first two characters of text in customer number eg db1234 to go DB1234
If you need first TWO chars in upper case then use the following:
sInput2 = UCase(Mid("db1234", 1, 2)) + LCase(Mid("db1234", 3))
Quote:
Originally Posted by RayComp
...Does any one know how to force input like new york to force the N and Y to uppercase...
VB Code:
Debug.Print StrConv("new york", vbProperCase) 'this will result in "New York"
Re: help with Foematting uppercase
Thanks. Trouble is that the input can be any city and is stored in access database.
So input is random and need to force the input to display capital letter after the space.
Re: help with Foematting uppercase
Quote:
Originally Posted by RayComp
Thanks. Trouble is that the input can be any city and is stored in access database.
So input is random and need to force the input to display capital letter after the space.
All you need to do is to substitute the variable name that contains your state name in Rhino's code, like
Debug.Print StrConv(MyStateName, vbProperCase)
Re: help with Foematting uppercase
Quote:
Originally Posted by RayComp
Thanks. Trouble is that the input can be any city and is stored in access database.
So input is random and need to force the input to display capital letter after the space.
That's no trouble... :) As Martin stated just replace hard coded "new york" (which was done only for demonstration as most of our samples) with some variable you might have.
Or you may even wrapp it in a function:
VB Code:
Public Function ConvertToProperCase(ByVal strValue As String) As String
ConvertToProperCase = StrConv(strValue, vbProperCase)
End Function
'usage:
Private Sub Command1_Click()
Dim sOldValue$, sNewValue$
sOldValue = "new york"
sNewValue = ConvertToProperCase(sOldValue)
Debug.Print sNewValue
End Function