Capitalization of the first letter only

D

DJW

I am attempting to set the format for a field. I know to make all the
letters cap you set the format to < and to set all the letters in a field to
small case you use the > sign.

What do I use to only capitalize the first letter but not the rest in a
word. I'm referring to the "format" setting of a field in form view.

Thank you.
 
A

Allen Browne

You can use the AfterUpdate event procedure of the control on your form to
change the value to proper case:
Me.Surame = StrConv(Me.Surname, vbProperCase)

This automatic assignment can be annoying. At very least you need to allow
the user to Undo the operation (as you can with AutoCorrect). In addition,
you probably need a table of exceptions so it does not apply proper case to
words like:
DLookup
McBain
ABC Enterprises
 
M

Marty Suckstorff

-----Original Message-----
I am attempting to set the format for a field. I know to make all the
letters cap you set the format to < and to set all the letters in a field to
small case you use the > sign.

What do I use to only capitalize the first letter but not the rest in a
word. I'm referring to the "format" setting of a field in form view.

Thank you.



.
UCase is not the function to use for capitalizing only
the first letter. Use StrConv. To change betty to Betty,
would be StrConv("betty",3). Similarly, jack jones, would
be StrConv("jack jones",3) and would yield Jack Jones.

Put this in the After Update event for the control you
wish to change. So if your control is called Last Name,
the complete expression would be:

[Last Name] = StrConv([Last Name],3)

Sometimes, this yields results you may not want. For
instance, po box doesn't become PO Box, it becomes Po Box,
etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top