Auto-Capitalize-First-Letter-in-MS-Access

Auto Capitalize First Letter While Typing in MS Access Forms

Here’s a small problem that adds up fast: you’re building a database, users start entering data, and within a week you have records where some names are all lowercase, some are ALL CAPS, and some are mixed in random ways. Now every report looks inconsistent, every exported file needs cleaning, and whoever maintains the database has to go back and fix it manually.

The good news is that MS Access can handle this for you automatically. With a bit of formatting or a small VBA code snippet, you can make your forms capitalize text correctly as the user types — so the data comes in clean from the start.

This guide is based on the Skill Header tutorial “Auto Capitalize First Letter While Typing in Forms | Stop Re-Typing!” and covers three methods, each suited to a different type of text field.

Why Bother Fixing Capitalization at the Source?

You could fix capitalization after the fact — running an update query, using a macro, or cleaning data before you export it. But all of those approaches are reactive. You’re cleaning up a mess that didn’t have to happen.

Fixing it at the input stage means:

  • Data is consistent from the moment it’s entered
  • Reports and exports look professional without extra work
  • Users don’t have to think about it or remember to follow any convention
  • You don’t accumulate a backlog of inconsistent records to clean later

It’s a small investment in setup that pays off every single time someone uses the form.

Method 1: Capitalize the First Letter of Every Word

This is the most commonly needed capitalization style — called Title Case or Proper Case. Every word starts with a capital letter. It’s exactly what you want for name fields, city fields, job titles, and address lines.

Examples of what it produces:

  • john smithJohn Smith
  • new yorkNew York
  • senior software engineerSenior Software Engineer

How to set it up

You don’t need any VBA code for this method. It’s done entirely through the Format property of the textbox.

  1. Open your form in Design View
  2. Select the textbox you want to apply this to
  3. Open the Property Sheet and go to the Format tab
  4. In the Format field, type the greater-than symbol:
>

That’s it. The > format character tells Access to display all text in the field as uppercase. But wait — that would make everything uppercase, not just the first letter of each word.

To get proper title case (first letter capitalized, rest lowercase), use the StrConv function in VBA on the After Update event instead:

vba

Private Sub txtName_AfterUpdate()
    Me.txtName = StrConv(Me.txtName, vbProperCase)
End Sub

StrConv with vbProperCase converts text to Proper Case — exactly what you need for names, cities, and similar fields. Add this to the After Update event of your textbox and every entry gets cleaned up the moment the user moves to the next field.

Method 2: Capitalize the First Letter of a Single Sentence

Not every field contains a name or a list of words. Some fields take a single sentence — a short description, a reason code, a comment. For these, you want the first word capitalized and everything else left as-is.

Examples of what it produces:

  • this item was returned by the customerThis item was returned by the customer
  • payment received via bank transferPayment received via bank transfer

How to set it up

This one uses VBA on the On Change event — so capitalization happens in real time, as the user types the very first character.

vba

Private Sub txtDescription_Change()
    Dim strText As String
    strText = Me.txtDescription.Text

    If Len(strText) = 1 Then
        Me.txtDescription.Text = UCase(Left(strText, 1))
        Me.txtDescription.SelStart = 1
    End If
End Sub

Here’s what this code does:

  • Me.txtDescription.Text gets the current content of the textbox as the user types
  • If Len(strText) = 1 checks if exactly one character has been typed — meaning it’s the very first keystroke
  • UCase(Left(strText, 1)) converts that first character to uppercase
  • Me.txtDescription.SelStart = 1 moves the cursor back to the end of what’s been typed, so the user can continue without interruption

The result: the first letter is always capitalized, the rest of the sentence is left exactly as the user types it.

Method 3: Capitalize the First Letter of Each Sentence (Paragraph Fields)

Some fields allow longer, multi-sentence input — notes, memos, descriptions, remarks. For these, you want each new sentence to start with a capital letter, not just the very first word of the whole entry.

Examples of what it produces:

  • this is the first note. this is the second note.This is the first note. This is the second note.

This is the most complex of the three methods, because the code needs to detect where one sentence ends and the next begins — specifically, it needs to watch for a period followed by a space.

How to set it up

Add this VBA code to the On Change event of the textbox:

vba

Private Sub txtNotes_Change()
    Dim strText As String
    Dim i As Integer
    strText = Me.txtNotes.Text

    If Len(strText) >= 1 Then
        ' Capitalize the very first character
        Mid(strText, 1, 1) = UCase(Left(strText, 1))
    End If

    ' Find every period followed by a space and capitalize the next letter
    For i = 1 To Len(strText) - 2
        If Mid(strText, i, 2) = ". " Then
            Mid(strText, i + 2, 1) = UCase(Mid(strText, i + 2, 1))
        End If
    Next i

    Me.txtNotes.Text = strText
    Me.txtNotes.SelStart = Len(strText)
End Sub

Let’s walk through this:

  • The first If block capitalizes the very first character of the whole field — same as Method 2
  • The For loop scans the entire text character by character, looking for the pattern . (a period followed by a space)
  • Whenever it finds that pattern, it capitalizes the character that comes right after — which is the first letter of the next sentence
  • Me.txtNotes.SelStart = Len(strText) keeps the cursor at the end of the text after each update

The Mid(strText, i, 1) = ... syntax is a specific VBA technique for replacing a single character inside a string without rebuilding the whole string. It’s efficient and works reliably in this kind of on-change scenario.

Choosing the Right Method for Each Field

All three methods solve a slightly different version of the same problem. Here’s a quick summary to help you decide which one to use where:

MethodBest ForTechnique
Proper Case (every word)Names, cities, job titles, addressesStrConv with vbProperCase on After Update
First letter of sentenceShort single-sentence fields (comments, reasons)UCase on first character in On Change
First letter of each sentenceLong memo/notes fields with multiple sentencesLoop with period-detection in On Change

In practice, you’ll likely use all three on different fields in the same form. A name field uses Method 1, a short comment field uses Method 2, and a long notes field uses Method 3.

A Few Things to Keep in Mind

Use On Change when you want real-time capitalization — the fix happens as the user types the first letter. Use After Update when you want to clean up after the user finishes the whole field and moves on.

Be careful with On Change and cursor position. Whenever you modify the .Text property inside On Change, Access refreshes the textbox, which can move the cursor to the beginning. The SelStart line at the end of each code block fixes this — it puts the cursor back where it should be. Don’t skip it.

StrConv is the simplest tool for name fields. If your field will always contain proper names or title-case text, StrConv(text, vbProperCase) handles everything cleanly in one line. The loop-based methods are only necessary when you need more control over exactly which letters get capitalized.

These methods don’t affect data already in the table. They only apply to new entries going forward. If you have existing records with inconsistent capitalization, you’d need a separate update query to clean those up — but going forward, all new entries will come in correctly formatted.

Final Thoughts

Auto-capitalizing text in your MS Access forms is one of those small quality-of-life improvements that nobody notices when it’s working — but everyone notices when it isn’t. A database full of consistently formatted names and descriptions looks professional. A database with random capitalization looks like it was thrown together.

These three methods cover the full range of text field types. Pick the one that matches each field, spend five minutes adding the code, and your forms will quietly keep your data clean for as long as the database is in use.

Watch the full tutorial on YouTube: Auto Capitalize First Letter While Typing in Forms | Stop Re-Typing! by Skill Header, and download the practice files at skillheader.com.