Article ID: 302499 - View products that this article applies to.
This article was previously published under Q302499
Moderate: Requires basic macro, coding, and interoperability skills.
For a Microsoft Access 2000 version of this article, see 253911
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, to 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 (VBA), 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 the StrConv function, search the Help Index for StrConv, and then click the StrConv function topic.
Article ID: 302499 - Last Review: January 31, 2007 - Revision: 3.1
Contact us for more help
Connect with Answer Desk for expert help.