First Letter Uppercase Only Access Tables
This article explains how you to create a macro that will force the first letter of a field to appear as uppercase and the rest as lowercase no matter what the user inputs.
Consider the table below:
We want to assign a macro to this table that will convert the first letter of the fields [First Name] and [Last Name] to uppercase, while converting the rest to lowercase.
Contents
Step 1:
Select and open the table you want to apply the macro to from the Navigation Pane on the left. Click on the Before Change button on the Table ribbon:
Step 2:
Select SetField from the drop down list:
Step 3:
After selecting SetFields, 2 fields will be added:
Name: This is the name of the field that will be modified. In this case it is [First Name]
Value: This is the value that the field will be change to. In this case use the expression below:
UCase(Left([First Name],1)) & LCase(Right([First Name],Len([First Name])-1))
Step 4:
Repeat step 3 for the [Last Name] field. Use the expression below:
UCase(Left([Last Name],1)) & LCase(Right([Last Name],Len([Last Name])-1))
Step 5:
Result:
No matter how the user inputs the first and last names, the first letter will be converted to uppercase and the rest of the characters will be converted to lowercase.
You can download the sample file used in this article from the link below:
See also:
- Access, Add Leading Zeros Custom Number Formats
- Access, Convert User Input to Uppercase
- Access, Convert User Input to Lowercase
- Access Field Properties Locked
- Access Check If Field is Null, Conditional Macro
- Access, Fixed Decimal Places Number Format
- First Letter Uppercase Only Access Form
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 www.software-solutions-online.com