Quantcast
Channel: Bacon Bits
Viewing all articles
Browse latest Browse all 33

Converting Text to Proper Case in Access

$
0
0

Wendy writes to ask:

"In Excel, I can use the PROPER function to change my text to proper case. Why is there is no PROPER function in Access? "

Wendy has stumbled on one of the mysteries of life - there are many functions you use in Excel that are not found in Access. Well…it's not really a mystery. I actually have an idea why this may be.

 

The Access "Jet" engine was originally developed by the SQL Server team, outside the realm of Excel. So a majority of the Access functions you can use are closely related to those you can use in SQL Server. This inevitably meant that Excel and Access would use different functions to accomplish certain tasks. Converting text to upper, lower, and proper case falls into this category.

So if Wendy wanted to convert her text to proper case in Access, she would need to use the STRCONV.

 

Using the StrConv function

For those of you who have never used the StrConv function, it does need a bit of explaining. The StrConv function allows you to convert a string to a specified conversion setting such as uppercase, lowercase, or proper case. For example, StrConv("my text",3) would be converted to proper case, reading "My Text".

 

Here is the basic syntax:

StrConv(Target String, Conversion Type)

 

Target String is the string to be converted. In a query environment, you can use the name of a field to specify that you are converting all the row values of that field.

Conversion type specifies how to convert the string. The following constants identify the conversion type.

    1 - Converts the string to uppercase characters.

    2 - Converts the string to lowercase characters.

    3 - Converts the first letter of every word in string to uppercase.

 

You would typically use the StrConv function in an update query.  This query would convert all the values in the Address field to proper case. 


Viewing all articles
Browse latest Browse all 33

Trending Articles