Sentence case

  • Thread starter Thread starter Thomas Wright
  • Start date Start date
T

Thomas Wright

I would love to use Word's sentence case in Access but its not there, at
least as a built in function. Would someone direct me to custom code for
this so I don't have to try to code this myself?

Thank you so much

Tom Wright
 
Thomas,

I was not able to find a reference in Word's help file on "sentence case",
so here are a couple of options for you:

1. Change: NOW IS THE TIME to Now is the time

Left("NOW IS THE TIME", 1) & LCase(Mid("NOW IS THE TIME", 2))

2. Change: NOW IS THE TIME to Now Is The Time

StrConv("NOW IS THE TIME", 3)


There are a number of functions in Access which can manipulate strings. In
VB Help, type: string functions in the Answer Wizard for a listing.
 
Thanks!

My first suggested option is what you can use for your task. My example,
of course, presumed that your text string was in solid caps. If the string
is all lower-case, use this:

1. Change: now is the time to Now is the time

UCase(Left("now is the time", 1)) & Mid("now is the time", 2))
 
How would this work with a street address?

1231 HOWARD LANE or

City like

Thousand Oaks as opposed to the city name like Ventura

Thanks

Tom
 
Sentence case would not be what you want for this example. Instead, use the
StrConv() function:

StrConv("1231 HOWARD LANE", 3) will return 1231 Howard Lane

It will also properly capitalize THOUSAND OAKS and VENTURA, returning
Thousand Oaks and Ventura
 
Cheryl, my problem with using functions is that the parenthetical material
has to be a referrence to a combo rather than a specific string like "1231
Howard Lane". It's not working for me.

Tom
 
I got it! Thank you so much. As much anything I was having trouble knowing
where to place the code. I placed these suggestions of yours and earlier
ideas of mine on the On Current Event of the Form preoperties. That worked.
None of my books covered event triggers.

Tom
 
Back
Top