Access Tip of the Day


Converting text to proper case (Access 97/2000/2002)


Like it or not, you sometimes may have to work with data that's entered completely in uppercase. Fortunately, you can change the way text is stored or displayed to use proper case. For example, you can change the name "JOHN SMITH" to "John Smith". To do so, you use the StrConv() function, which can accept either a literal string or a control reference. If you're working with the function in VBA, you'd use something like:

StrConv("JOHN SMITH", vbProperCase)

or

StrConv(Me.Controls("Company"), vbProperCase)

You can also use the StrConv() function in queries and controls; however, you can't use the vbProperCase constant. Instead, you must use the numeric value that the constant represents--3.

Let's say that you want to convert data from a field called Address and display it in a textbox control on a report. To show the converted data, you'd add a textbox control to the report and then change the control's Control Source property to:

=StrConv([Address],3)



(Content provided by Element K Journals)


(Note: Your browser is set to refuse cookies. As a result, you may frequently see previously-viewed tips)
 
PrintPrint CloseClose

Copyright © 2001 - 2025 MJ Technologies, LLC.  All rights reserved.