Proper case

  • Thread starter Thread starter Natalie
  • Start date Start date
N

Natalie

Hi there,

I am a beginner at VB and have 2 questions...

1. How do I convert a text field to Proper case. I have
searched for this and found various code samples but
don't know where to place these??

2. Is the a good site with examples of simple macros and
modules?

Any help is appreciated!

Natalie
 
Hi there,

I am a beginner at VB and have 2 questions...

1. How do I convert a text field to Proper case. I have
searched for this and found various code samples but
don't know where to place these??

2. Is the a good site with examples of simple macros and
modules?

Any help is appreciated!

Natalie

For new data:
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 capitaliztion 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 both 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.

If you wish to convert already stored data, you would use an Update
query:

Update YourTable Set YourTable.[FieldName] = StrConv([FieldName],3);
 
Back
Top