Navigation:  Articles > Jul-1997 >

Tip: The Built-In Proper Case Function etc

Previous pageReturn to chapter overviewNext page

Paul Litwin

 

Microsoft introduced an odd new function called StrConv in the version of VBA that ships with Access 95. This function has some interesting but not commonly used functionalxity such as converting strings from ANSI to Unicode (and back) and from one type of Far East character system to another. In addition, StrConv includes the ability to change a string to all uppercase, all lowercase, or proper case. The first items aren't that exciting, because Access Basic has always had the UCase and LCase functions. However, Access previously lacked an intrinsic function that converted text to proper case.

 

For example, if you type the following into the Debug window:

 

?StrConv("FRESH AIR, times square!", vbProperCase)

 

 

Access responds with:

 

Fresh Air, Times Square!

 

 

 

The algorithm used by StrConv is simple: every letter that begins a word is capitalized; every letter that doesn't begin a word is changed into lowercase. Valid word separators are: a space (Chr(32)), a Null (Chr(0)), a horizontal or vertical tab (Chr(9) or Chr(11)), a line feed (Chr(11)), a form feed (Chr(12)), or a carriage return (Chr(13)).