First Letter Uppercase Only Access Form

This article explains how you can format the user input in an Access form so that the first character will appear as uppercase and the rest of the input will appear as lowercase, regardless of the way the user has input the data. The method explained in this article uses VBA.

Consider the form below:
Sample Form

The user can input a first and last name in the form. We want to the first letter of the input to appear as upppercase and the rest of the input to appear as lowercase regardless of how the user decides to input values in the textboxes.

Step 1:

Open the form in design view. Click on the View Code button:
View Code

Step 2:

Select the form class from the Project Explorer on the left. Select the textbox from the drop down list. In this example it’s First_Name:

Step 3:

Select the LostFocus event from the drop down list on the right. Basically we want this conversion to occur “after” the user has finished inputting text:
Lost Focus
The code below will be generated:
LostFocus Code

Step 4:

Add the following code to the LostFocus event handler:

Private Sub First_Name_LostFocus()
First_Name.Text = UCase(Left(First_Name.Text, 1)) _
& LCase(Right(First_Name.Text, Len(First_Name.Text) - 1))
End Sub

Note: It is assumed that the name of the textbox is First_Name. The name of the textbox can be modified in design view from the Property Sheet:
Textbox Name

Step 5:

Add the following code for the Last_Name textbox:

Private Sub Last_Name_LostFocus()
Last_Name.Text = UCase(Left(Last_Name.Text, 1)) _
& LCase(Right(Last_Name.Text, Len(Last_Name) - 1))
End Sub


No matter how the user inputs values in the First_Name and Last_Name textboxes, the first character will be converted to uppercase and the rest will be converted to lowercase.


You can download the sample file used in this article from the link below:

See also:

If you need assistance with your code, or you are looking for a VBA programmer to hire feel free to contact me. Also please visit my website

3 thoughts on “First Letter Uppercase Only Access Form”

Leave a Reply

Your email address will not be published. Required fields are marked *