Capital Letters in a field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dbar10
    New Member
    • Nov 2008
    • 17

    Capital Letters in a field

    In Access, there used to be a way to Set the first letter in a field to automatically UpperCase in a form or table to override a lowercase entry. Does anyone know what that is? Thanks
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    I know of 2 ways to do this.
    One is to put code somewhere to fix what the user entered:
    Code:
    Private Sub Text2_Exit(Cancel As Integer)
        Text2 = StrConv(Text2, vbProperCase)
    End Sub
    which will capitalize every word, whether you like it or not.

    The other is to put an input mask on the field like
    >A<CCCCCCCCCCCC CCCC
    but that makes the first character (which is required) capitalized, and all subsequent letters (optional) small. It doesn't allow any more capital letters, but it does allow you to set a maximum length by the number of C's you put in.

    Here's info on input masks:
    Last edited by ChipR; Dec 1 '08, 10:10 PM. Reason: Add link

    Comment

    • missinglinq
      Recognized Expert Specialist
      • Nov 2006
      • 3533

      #3
      To capitalize only the first character in a textbox:

      Code:
      Private Sub TextboxName_AfterUpdate()
        Me.TextboxName = UCase(Left(Me.TextboxName, 1)) & Right(Me.TextboxName, Len(Me.TextboxName) - 1)
      End Sub
      The Exit event should not be used for this kind of thing, it will fire every time the user tabs thru the field. Use the AfterUpdate event instead;it will only fire if the data is entered for the first time or is edited.

      Linq ;0)>

      Comment

      • Dbar10
        New Member
        • Nov 2008
        • 17

        #4
        Thank you ChipR This will work for what I need.

        Comment

        Working...