Format text in proper case

R

Roy Waters

I want all text fields in my database to automatically
format text to proper case (ie. if I enter SMITH or smith,
I want it to automatically change it to Smith). What is
the most efficient way of doing this?

Thank you in advance!!!

Roy
 
A

Allen Browne

To store a field in proper case, use the AfterUpdate event procedure of the
control on your form:
Me.Surname = StrConv(Me.Surname, vbProperCase)

Before you do that, you may like to consider what this approach will do with
names such as:

McDonald
O'Brien
van Leen
At very least, you will need to create a table of exceptions, and lookup the
exceptions before converting the case.
 
A

Allen Browne

I would not try to do this at the table level, and nor do I like input
masks.
Formatting has the limitation that it affects the display only, which is
confusing to users who export to Word for a mail merge and discover the text
is not correctly formatted.

All of those approaches are useless in practice as they cannot handle the
exceptions.
 

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