Article ID: 253911 - View products that this article applies to.
This article was previously published under Q253911
Moderate: Requires basic macro, coding, and interoperability skills.
This article applies only to a Microsoft Access database (.mdb).
For a Microsoft Access 2002 version of this article, see 298607
This article provides examples for using a built-in function called StrConv that you can use to capitalize the first character of a word or a set of words. This function is not affected by leading spaces, but it does have the following limitations for some names:
The StrConv function can be used to change the case of a string to uppercase, lowercase, or so that the first letter is uppercase. The syntax is StrConv(string, conversion, where "string" is the text string and "conversion" is 1, 2, or 3. For "conversion," uppercase is 1, lowercase is 2, and 3 makes the first letter of each word uppercase.
When writing the StrConv function in Visual Basic for Applications, instead of the integers 1, 2, or 3, you can also use one of the following constants:
vbUpperCase Converts the entire string to uppercase.NOTE: The StrConv function has more constants than just the three that are mentioned here; however, this article focuses only on the three constants that are used for case conversion.
vbLowerCase Converts the entire string to lowercase.
vbProperCase Converts the first letter of each word to uppercase and the remaining letters to lowercase.
Demonstrating the StrConv Function
Using StrConv in Code in the AfterUpdate Property of a Control
Using StrConv in a Query
Using StrConv in a Macro
For more information about other constants of StrConv function, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type strconv in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
Article ID: 253911 - Last Review: June 28, 2004 - Revision: 2.0
Contact us for more help