By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,153 Members | 960 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,153 IT Pros & Developers. It's quick & easy.

Change text case

P: n/a
How can you get the contents of a text box to change after for click
out of it. Eg I have a text box on a form called Ownername. If some
one enters a name in lower case that it automatically changes it to
sentence case ie john smith goes to John Smith

Thanks
Denis

Jan 31 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,
How can you get the contents of a text box to change after for click
out of it. Eg I have a text box on a form called Ownername. If some
one enters a name in lower case that it automatically changes it to
sentence case ie john smith goes to John Smith
Try:
Me!Ownername = StrConv(Me!Ownername, vbProperCase)

Regards
Jens
Jan 31 '07 #2

P: n/a
Jens Schilling wrote:
Hi,

>>How can you get the contents of a text box to change after for click
out of it. Eg I have a text box on a form called Ownername. If some
one enters a name in lower case that it automatically changes it to
sentence case ie john smith goes to John Smith


Try:
Me!Ownername = StrConv(Me!Ownername, vbProperCase)

Regards
Jens

Adding to what Jens mentioned, I might put in some additional code to
proper case something. In the declarations (under Option Explicit) I
might enter
Dim blnOwner As Boolean
and in the OnCurrent event enter
blnOwner = (Me.NewRecord)
to set a state of variable. Then in the AfterUpdate event of Owner I
might have
If Me.NewRecord And blnOwner then
Me!Owner = StrConv(Me!Owner, vbProperCase)
blnOwner = False
Endif
Now, the field gets propercased after the first entry. If the person
wants to edit it, it won't change the case. So this first time thru you
might enter "BBB" and casing it returns "Bbb", but it should be "BBB".
It won't change it to Bbb if you enter BBB again.
Jan 31 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.