Results 1 to 4 of 4
  1. #1
    MatthewGrace is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2013

    Capitalize first letter of a bound textbox.

    Thank you for considering my question!

    It seems like such a common thing I'm doing here, but I couldn't find an archived apples-to-apples post requesting the same thing. Please suffer me if this question has been answered elsewhere in different wording.

    I have a field called Status with the "short text" datatype. Many thousands of records have already been entered in all lowercase.

    My job is to simply bind the .ControlSource property of a textbox to this Status field. Easy enough - everything works just fine. Now if only I could get the first letter to be capitalized.

    In my foolishness, I tried making the .ControlSource property read:
    =StrConv([Status], vbProperCase)

    This does not work. I'm not 100% sure why - as an aside, it would be helpful if someone could explain that to me. I'm a bit rusty at this.

    I looked through MS documentation on the format property for the textbox. You can put a ">" in this property to make the entire contents of this textbox capitalized. But that doesn't help me any - I only want the first letter capitalized. I couldn't find any easy, predesigned way from MS to do this.

    I could always do the StrConv() function as an Expression Field in the Query bound to this Form's recordset, and that will work, but I feel dirty that I can't figure out how to make a simple textbox format correctly.

    Tell me I'm missing something obvious?

    Thank you!

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Essex UK
    Use the expression in the forms query to create a calculated field. Something like:
    Stat:StrConv([Status], vbProperCase)
    Then use Stat as the Control Source for the textbox.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Welshgasman is online now Expert
    Windows 10 Access 2007
    Join Date
    Jan 2017
    Swansea,South Wales,UK
    I'd use the afterupdate event of the control to format as you want. Then run an update query to fix all those records afterwards, if it means that much to you?
    Please, please use # when posting code snippets.
    Cross Posting Etiquette:
    Debugging Access:

  4. #4
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    UK - Wiltshire
    Another option would be to simply update the contents as a one off update query.

    UPDATE YourTable SET [STATUS] = StrConv([Status], vbProperCase)

    Then in the form where you enter this data update it on entry so that new data is in the desired format.

    Private Sub Status_AfterUpdate()
    Me.YourStatusControl = StrConv(Me.YourStatusControl, vbProperCase)
    End Sub
    Edit : I have no idea why I can't format that code as one block...
    DLookup Syntax and others
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 10-28-2017, 08:28 AM
  2. Replies: 3
    Last Post: 01-09-2017, 09:47 AM
  3. Replies: 4
    Last Post: 05-17-2014, 06:32 PM
  4. unbound textbox to bound textbox
    By thescottsman92 in forum Access
    Replies: 3
    Last Post: 08-29-2013, 02:02 AM
  5. Replies: 8
    Last Post: 04-12-2013, 08:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Other Forums: Microsoft Office Forums - Senior Forums