StrConv(MyString, vbProperCase) Function

  • Thread starter Thread starter DavidW
  • Start date Start date
DavidW said:
I cannot find an example of this, can some help steer me in the right
direction?

What are you having problems with?

In VBA code...
StrConv("johN jONes", vbProperCase) returns "John Jones"

In a query or ControlSource you can't use the named constant so you use the
numerical value instead:

StrConv("johN jONes", 3) returns "John Jones"
 
Open the Immediate Window (Ctrl+G), and enter:
? StrConv("fREd jOnEs", vbProperCase)
VBA returns:
Fred Jones

If you are trying to change the case of a field named "MyField":
1. Create a query into your table.
2. Change it to an Update query (Update on Query menu).
3. In the Update row under MyField, enter:
StrConv([MyField], 3)
4. Run the query.
 
DavidW said:
I am learning
Where and how do you use this

It's a function. Where you would use it is any place where changing the case of
a string to proper case would be useful. You could use it in a SELECT query to
display a field in proper case without altering the base data.

SELECT strConv([SomeField],3) AS SomeAlias FROM SomeTable

You could use it in an UPDATE query to change the data that is stored in a table
to proper case.

UPDATE SomeTable SET [SomeField] = strConv([SomeTable]![SomeField],3)

You could use it in the ControlSource of a TextBox on a form or report to
display a field value in proper case.

=strConv([SomeField],3)
 
Back
Top