469,609 Members | 1,721 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

Capatalise the first letter of every word

Is there a simple way to capatalise the first letter of every word
typed into a textbox on a form. Someone told me to use "Proper" but not
sure if this is correct or how and where to use it.

Please can someone help.
Many thanks in advance!

Nov 13 '05 #1
2 2655
si************@gmail.com wrote:
Is there a simple way to capatalise the first letter of every word
typed into a textbox on a form. Someone told me to use "Proper" but not
sure if this is correct or how and where to use it.

Please can someone help.
Many thanks in advance!

In your AfterUpdate event for the textbox you can use StrConv(). Ex:
Me.Text0 = StrConv(Me.Text0,vbProperCase)

There may be times that one would want to have upper case. Ex: ABC
Company. You could create a global variable for the form under the
Option Explicit/Option Compare statements.
Dim blnCompany As Boolean
and in the OnCurrent event enter something like
blnCompany = False
and in the AfterUpdate event enter
If Me.NewRecord And Not blnCompany Then
'proper case it only at 1st time of entry
'if this is a new record. If editting an existing
'record, let the op enter whatever
Me.Text0 = StrConv(Me.Text0,vbProperCase)
End If
blnCompany = True
so that the first time the value is entered it will change the value to
a proper case if required but it can be overwritten later on.
Nov 13 '05 #2
si************@gmail.com wrote:
Is there a simple way to capatalise the first letter of every word
typed into a textbox on a form. Someone told me to use "Proper" but not
sure if this is correct or how and where to use it.

Please can someone help.
Many thanks in advance!

In your AfterUpdate event for the textbox you can use StrConv(). Ex:
Me.Text0 = StrConv(Me.Text0,vbProperCase)

There may be times that one would want to have upper case. Ex: ABC
Company. You could create a global variable for the form under the
Option Explicit/Option Compare statements.
Dim blnCompany As Boolean
and in the OnCurrent event enter something like
blnCompany = False
and in the AfterUpdate event enter
If Me.NewRecord And Not blnCompany Then
'proper case it only at 1st time of entry
'if this is a new record. If editting an existing
'record, let the op enter whatever
Me.Text0 = StrConv(Me.Text0,vbProperCase)
End If
blnCompany = True
so that the first time the value is entered it will change the value to
a proper case if required but it can be overwritten later on.
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Andrew James | last post: by
reply views Thread by simonmarkjones | last post: by
reply views Thread by Solution2021 | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.