Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert String to ProperCase, UPPERCASE, lowercase

Access Howto:

Convert String to ProperCase, UPPERCASE, lowercase

by  JoeMiller  Posted    (Edited  )
A question often asked is how to convert text from some case to Proper Case like the Excel function Proper(). Access has a function that does what Proper() does and a whole lot more like UPPERCASE and lowercase. The function is StrConv().

It's usage is like so:

[tt]
StrConv([MyStringHere],vbCaseToConvert)
[/tt]

For each type, the vbCaseToConvert is the following:

CaseDesired = Constant
ProperCase = vbProperCase
UpperCase = vbUpperCase
LowerCase = vbLowerCase

So to convert a variable named strString which equals "jim bean drinks a lot of alcohol." to Proper Case we would do the following:

[tt]
strString = StrConv(strString, vbProperCase)
[/tt]

And we'd get "Jim Bean Drinks A Lot Of Alcohol." as our answer. Hope that helps, please leave me email with comments and questions!

Joe Miller
joe.miller@flotech.net
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top