Format text in proper case

  • Thread starter Thread starter Roy Waters
  • Start date Start date
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
 
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.
 
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.
 
Back
Top