Read time 6 minutes

Summary: This blog outlines three working methods to convert data values of the text data type to proper case format in MS Access. These include using the Built-In String Conversion Function, a User-Defined Function and an Update Query. For any kind of Access corruption issues, you can opt for Kernel for Access Database Repair that fixes your issues quickly with its top-notch algorithms.

In Microsoft Access, the default data type is TEXT. However, users have the flexibility to change the data type to one that suits their needs. Selecting the right data type is a matter of personal choice and ensures optimal query and search results. This article is a valuable resource for MS Access database users, offering guidance on converting Text data type values into the proper case format. Read on to learn the step-by-step process.

Best ways to convert data values of the text data type to proper case format

There are three ways with which you can convert data values of the Text data type to proper case format.

  1. Use the Built-In String Conversion Function
  2. Use a User-Defined Function
  3. Use an Update Query

Before going for any one of the above methods, first of all, create a sample table named MyTestTextList in the new blank database MyTestDatabase.

Use the Built-In String Conversion Function

  • Open the MyTestDatabase database in Access.
  • On the Insert menu, click Query.
    In MS Office Access 2007, click Query Design in the Other group on the Create tab
  • In the New Query dialog box, click Design view.
    In Access 2007, skip this step.
  • In the Show Table dialog box, click Close.
  • On the View menu, click SQL View.
    In Access 2007, click SQL in the Results group on the Design tab.
  • Type the code in the SQL view
SELECT testText, STRCONV(testText,3) as  TestText_in_Proper_Case FROM MyTestTextList
  • On the Query menu, click Run.

In Access 2007, click Run in the Results group on the Design tab

Use a user-defined function

  • Open the MyTestDatabase database in Access.
  • On the Insert menu, click Module.

In Access 2007, click the drop-down arrow under Macro in the Other group on the Create tab.

  • Type the following code in the current module and save your changes.
Function Proper(X)
Capitalize first letter of every word in a field.
Dim Temp$, C$, OldC$, i As Integer
If IsNull(X) Then
Exit Function
Else
Temp$ = CStr(LCase(X))
‘ Initialize OldC$ to a single space because first
‘ letter must be capitalized but has no preceding letter.
OldC$ = ” “
For i = 1 To Len(Temp$)
C$ = Mid$(Temp$, i, 1)
If C$ >= “a” And C$ <= “z” And (OldC$ < “a” Or OldC$ > “z”) Then
Mid$(Temp$, i, 1) = UCase$(C$)
End If
OldC$ = C$
Next i
Proper = Temp$
End If
End Function
  • On the File menu, click Close and Return to Microsoft Access.
  • On the Insert menu, click Query. In Access 2007, click Query Design in the Other group on the Create tab
  • In the New Query dialog box, click Design view. In Access 2007, skip this step.
  • In the Show Table dialog box, click Close.
  • On the View menu, click SQL View. In Access 2007, click SQL in the Results group on the Design tab.
  • Type the following code in the SQL view
SELECT testText, proper(testText) as testText_in_Proper_Case FROM MyTestTextList

This query is similar to the query in Method 1. This is except for the function call.

  • On the Query menu, click Run. In Access 2007, click Run in the Results group on the Design tab

The second method provides flexibility in choosing any desired case format, allowing for the conversion of Text data type values to the proper case format in MS Access.

Use an Update Query

Sometimes, you will need to use text from a specific case, and this might not be the text that was entered into the database. Data from your forms and reports may appear incorrect if you entered the text incorrectly to begin with.

Using the StrConv() function in Microsoft Access, we can update data in the table. You can convert text to these formats using String Conversion’s arguments:

  • UpperCase
  • LowerCase
  • ProperCase

In the query design, the strCv function is used, but the vbProperCase constant cannot be used. As a result, we should use the value 3 that the constant represents (since we are converting using ProperCase).

Here is how the SQL would look for this:

UPDATE tblEmployeeFullNames
SET tblEmployeeFullNames.EmployeeFullName = StrConv([EmployeeFullName],3)

An automated Access repair tool can be a lifesaver in restoring corrupt MDB databases to their functional state. The Kernel for Access Database Repair tool excels at recovering tables, key data structures, auto numbers, table relationships, OLE data, and memo data while preserving original date formats. It effectively addresses all corruption-related problems in MDB and ACCDB files, offering various repair modes for precise recovery. Users can preview content before saving, and the tool is compatible with all MS Access database versions.

Here, we outline the operational process of the Kernel for Access Database Repair tool, designed to recover and restore corrupt MDB databases to their functional state.

  1. Launch the installed Kernel for Access Repair on your system.
  2. Click ‘Select File’ to browse and add the corrupted Access database files.
    Select file
  3. Select the Mode to repair the corrupt Access file. Then click Repair.
    Select the Mode to repair the corrupt Access file
  4. Wait until the scan and repair process gets completed.
    scan and repair process
  5. Once the process gets completed, you can preview the recovered file by selecting the objects from the left panel. Click Save to save the required file.
    preview the recovered file
  6. Provide a destination path to save the recovered file and click Save.
    Provide a destination path
  7. The repaired database file will be saved at the specified location.
    Database is saved

Hence the easy restoration of the corrupted MDB file is completed conveniently.

Wrapping up

We have provided three basic methods for converting the Text data type to the proper case in Microsoft Access. From using the Built-In String Conversion Function, a User-Defined Function to an Update Query, you just need to carry out the steps carefully. As an added bonus to counter Access corruption issues, we have discussed the Kernel for Access Database Repair tool. Its easy to use interface and simple yet advanced features make it a must-have tool for all kinds of users working with MS Access. Take the trial today.

Kernel for Access Database Repair