In Microsoft Access, the default data type is TEXT data type. However, one can change the text data type to another desired data type. Choosing a specific data type is totally one’s own perception and his/her choice as doing so ensures that you will get the best results from your queries and searches. If you are using MS Access database, then this article would be of great help. This article describes steps involved in converting data values of Text data type to the proper case format in MS Access.
There are two ways with which you can convert data values of Text data type to proper case format.
Before going for any one of the above method, first of all create a sample table named MyTestTextList in new blank database MyTestDatabase.
Use the Built-In String Conversion Function
SELECT testText, STRCONV(testText,3) asÂ TestText_in_Proper_Case FROM MyTestTextList
In Access 2007, click Run in the Results group on the Design tab
Use a user-defined function
In Access 2007, click the drop-down arrow under Macro in the Other group on the Create tab.
Capitalize first letter of every word in a field.
Dim Temp$, C$, OldC$, i As Integer
If IsNull(X) Then
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$)
OldC$ = C$
Proper = Temp$
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.
Second method gives you the flexibility to select any case format. This way you are able to convert data values of Text data type to proper case format in MS Access.
Access repair tool helps to restore corrupt MDB databases to working databases. Kernel for Access recovers tables, key data structures, auto number, table relationships, OLE data, memo data with original date formats.