Remove CAPS

  • Thread starter ladybug via AccessMonster.com
  • Start date
L

ladybug via AccessMonster.com

I have a text box in a form called Description. I do not want users to be
able to enter in here with all CAPS. They have been instructed, but there
are still a few that occasionaly forget. I played around with the < and > in
Format, but the description can be fairly long and using these will cut off
some of the info.

Is there any other code that will remove the CAPS if entered that way?
However, I would prefer for it to keep the CAP in the beginning of a sentence.


Thank you!
 
T

Tom van Stiphout

On Wed, 02 Jun 2010 12:44:37 GMT, "ladybug via AccessMonster.com"

One possibility would be in the control's AfterUpdate event:
Me.Description.Value = StrConv(Me.Description.Value, vbProperCase)
or perhaps:
Me.Description.Value = UCase$(Left$(Me.Description.Value ,1)) &
LCase$(Mid$(Me.Description.Value ,2)
Often these exercises become counter-productive since some sentences
naturally have some capitalization.

How about testing for all uppercase in the control's BeforeUpdate
event:
if ucase$(Me.Description.Value)=Me.Description.Value then
msgbox "Yo! Not all uppercase!", vbCritical
Cancel = true 'forces them to change it.
end if

-Tom.
Microsoft Access MVP
 
L

ladybug via AccessMonster.com

The first suggestion will not work because as you said it will remove the
uppercase in the text where it should actually exist (beginning of sentence).
The second could work, but I know the users will have an issue with having to
retype the whole thing over when they get that error at the very end.

I really need this to only update the text to lowercase in a report. Is
there some code I can put in the Text Box Description in the report to just
remove all the CAPS, except for in the beginning of sentences?
One possibility would be in the control's AfterUpdate event:
Me.Description.Value = StrConv(Me.Description.Value, vbProperCase)
or perhaps:
Me.Description.Value = UCase$(Left$(Me.Description.Value ,1)) &
LCase$(Mid$(Me.Description.Value ,2)
Often these exercises become counter-productive since some sentences
naturally have some capitalization.

How about testing for all uppercase in the control's BeforeUpdate
event:
if ucase$(Me.Description.Value)=Me.Description.Value then
msgbox "Yo! Not all uppercase!", vbCritical
Cancel = true 'forces them to change it.
end if

-Tom.
Microsoft Access MVP
I have a text box in a form called Description. I do not want users to be
able to enter in here with all CAPS. They have been instructed, but there
[quoted text clipped - 6 lines]
Thank you!
 
T

Tom van Stiphout

On Wed, 02 Jun 2010 19:23:03 GMT, "ladybug via AccessMonster.com"

I already showed you that:
UCase$(Left$(Me.Description.Value ,1)) &
LCase$(Mid$(Me.Description.Value ,2)
If you look at it closely this capitalizes the first character and
converts the rest to lowercase.
Again, I wouldn't do this because some sentences naturally have upper
case letters in the non-first position.

-Tom.
Microsoft Access MVP

The first suggestion will not work because as you said it will remove the
uppercase in the text where it should actually exist (beginning of sentence).
The second could work, but I know the users will have an issue with having to
retype the whole thing over when they get that error at the very end.

I really need this to only update the text to lowercase in a report. Is
there some code I can put in the Text Box Description in the report to just
remove all the CAPS, except for in the beginning of sentences?
One possibility would be in the control's AfterUpdate event:
Me.Description.Value = StrConv(Me.Description.Value, vbProperCase)
or perhaps:
Me.Description.Value = UCase$(Left$(Me.Description.Value ,1)) &
LCase$(Mid$(Me.Description.Value ,2)
Often these exercises become counter-productive since some sentences
naturally have some capitalization.

How about testing for all uppercase in the control's BeforeUpdate
event:
if ucase$(Me.Description.Value)=Me.Description.Value then
msgbox "Yo! Not all uppercase!", vbCritical
Cancel = true 'forces them to change it.
end if

-Tom.
Microsoft Access MVP
I have a text box in a form called Description. I do not want users to be
able to enter in here with all CAPS. They have been instructed, but there
[quoted text clipped - 6 lines]
Thank you!
 
A

Al Campagna

ladybug,
I don't think you'll find a perfect solution to this problem.
Proper, and Ucase provide some functionality, but they can not
properly handle all real world Caps/Lowercase requirements...
particularly in "sentence" type text.
I am unaware of any application that can properly convert
random, all caps sentences/words to correct Upper/Lower case text.

In this case, I think your best bet is to make some warning text visible
when users enter the field. Something like a label ("Do not use all caps!")
made visible, and flashing for just a second or two... on the field's
OnEnter event. A message box is a bit intrusive, but just some
flashing text for a moment, should be sufficient.
If not, then you have a "user" problem... not a design" problem.

I think this is a case of... "It's better to prevent a problem from
happening, than to try to code around it."
You have responsibilities as a developer, but the users have
responsibilities too.
--
hth
Al Campagna
Microsoft Access MVP 2007-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

ladybug via AccessMonster.com said:
The first suggestion will not work because as you said it will remove the
uppercase in the text where it should actually exist (beginning of
sentence).
The second could work, but I know the users will have an issue with having
to
retype the whole thing over when they get that error at the very end.

I really need this to only update the text to lowercase in a report. Is
there some code I can put in the Text Box Description in the report to
just
remove all the CAPS, except for in the beginning of sentences?
One possibility would be in the control's AfterUpdate event:
Me.Description.Value = StrConv(Me.Description.Value, vbProperCase)
or perhaps:
Me.Description.Value = UCase$(Left$(Me.Description.Value ,1)) &
LCase$(Mid$(Me.Description.Value ,2)
Often these exercises become counter-productive since some sentences
naturally have some capitalization.

How about testing for all uppercase in the control's BeforeUpdate
event:
if ucase$(Me.Description.Value)=Me.Description.Value then
msgbox "Yo! Not all uppercase!", vbCritical
Cancel = true 'forces them to change it.
end if

-Tom.
Microsoft Access MVP
I have a text box in a form called Description. I do not want users to
be
able to enter in here with all CAPS. They have been instructed, but
there
[quoted text clipped - 6 lines]
Thank you!
 

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