Formatting or Input Masking Text in Forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've created a database for use in my office and I'd like to apply a Format
or Input Mask which would store the text entered in a field, using a Form, in
Title case, regardless of whether the text is entered in lower or upper case.
I've seen some examples which will go half way to what I want to do but not
exactly. What i would like to acheive is that each word entered would start
with an uppercase letter, then continue in lowercase until a space is entered
, then start a new word with the same format. i.e. 'Acme Widgets Ltd' or
'West Yorkshire Puddings'
It would need to be stored in this format as I would be producing Reports
with the data
Is there any way to do this?

Regards

Colin
 
Hi,
you could try this on the before or after update event of your control:

Me.YourControl = StrConv(Me.YourControl, vbProperCase)

HTH
Good luck
 
I've created a database for use in my office and I'd like to apply a Format
or Input Mask which would store the text entered in a field, using a Form, in
Title case, regardless of whether the text is entered in lower or upper case.
I've seen some examples which will go half way to what I want to do but not
exactly. What i would like to acheive is that each word entered would start
with an uppercase letter, then continue in lowercase until a space is entered
, then start a new word with the same format. i.e. 'Acme Widgets Ltd' or
'West Yorkshire Puddings'
It would need to be stored in this format as I would be producing Reports
with the data
Is there any way to do this?

Regards

Colin

On the Form's control's AfterUpdate event code:
Me![ControlName] = StrConv([ControlName],3)

Note: this will incorrectly capitalize some words which contain more
than one capital, i.e. O'Brien, MacDonald, IBM, Jones-Smith, ABC,
etc., and incorrectly capitalize some words that should not have any
capitals, or whose capitalization depends upon usage, such as e. e.
cummings, abc, van den Steen.
Then some names can be capitalized in more than one manner, depending
upon personal preference, i.e. O'Connor and O'connor, McDaniels and
Mcdaniels, etc. are all correct.

You can create a table of exceptions and have the code use DLookUp
with a message if one of the exception words is found.
 
Thanks Fred, it works a treat

Colin

fredg said:
I've created a database for use in my office and I'd like to apply a Format
or Input Mask which would store the text entered in a field, using a Form, in
Title case, regardless of whether the text is entered in lower or upper case.
I've seen some examples which will go half way to what I want to do but not
exactly. What i would like to acheive is that each word entered would start
with an uppercase letter, then continue in lowercase until a space is entered
, then start a new word with the same format. i.e. 'Acme Widgets Ltd' or
'West Yorkshire Puddings'
It would need to be stored in this format as I would be producing Reports
with the data
Is there any way to do this?

Regards

Colin

On the Form's control's AfterUpdate event code:
Me![ControlName] = StrConv([ControlName],3)

Note: this will incorrectly capitalize some words which contain more
than one capital, i.e. O'Brien, MacDonald, IBM, Jones-Smith, ABC,
etc., and incorrectly capitalize some words that should not have any
capitals, or whose capitalization depends upon usage, such as e. e.
cummings, abc, van den Steen.
Then some names can be capitalized in more than one manner, depending
upon personal preference, i.e. O'Connor and O'connor, McDaniels and
Mcdaniels, etc. are all correct.

You can create a table of exceptions and have the code use DLookUp
with a message if one of the exception words is found.
 
Sorry Oliver, I couldn't get that to work.
It's probably me, I wasn't sure which of the arguments should be in
parenthesis, or whether Me should be followed by !.
Fredg's suggestion worked though.
Thanks for your response

Colin
 

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

Back
Top