Automatically change the first letter of a word/sentence to upper case

Applies to: InfoPath 2003

Use the concat(), substring(), translate(), and string-length() function within a formula to convert the first letter in a word or sentence.



When an InfoPath user types in the text "example" or "this is really cool!", you would like this text to automatically be changed into "Example" or "This is really cool!" when the user leaves the text field.


Use the concat(), substring(), translate(), and string-length() functions in a formula to format the text field.


You can accomplish this functionality as follows:

  1. Create a New Blank Form in InfoPath.
  2. Add a Text Box control to the form.
  3. Double-click on the text box control to open its Properties dialog box.
  4. Click on the Insert Formula button behind the Default Value field.
  5. Enter the following formula on the Insert Formula dialog box:
    concat(substring(translate(., "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), 1, 1), substring(., 2, string-length(.) - 1))
  6. Click on the OK button when closing all open dialog boxes.

The first letter of a word or sentence typed into the text box should now automatically be converted into an upper case letter whenever the text box loses the focus.


Related InfoPath Articles:


Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author.