Customer name formatting

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

Guest

I would like to format a field to accept data entry in any case and then
convert the entry to first letter upper case and all other letters to lower
case. Can someone tell me how I can do this? Thanks!
 
I would like to format a field to accept data entry in any case and then
convert the entry to first letter upper case and all other letters to lower
case. Can someone tell me how I can do this? Thanks!

If the date entry is a single word:
Me![ControlName] = StrConv([ControlName],3)
Note: This will not correctly capitalize names that should have more
than one capital letter, i.e. McDonald, O'Brien, nor correctly
capitalize names like van Buren, which do not have a capital first
letter.

If the entry is a sentence or phrase:
Me![ControlName] = UCase(Left([ControlName],1) &
LCase([Mid([ControlName],2)

Note: if a word within the sentence should be capitalized it will not
be, i.e. This is the city of new york.
 
I recently was asked by a client to provide exactly this same functionality
but, as fredg has said, the problem arises when these other names are entered.

My solution to this was to create a table of exceptions. Then on the after
update event of each field that I wanted to apply the Proper Case to, I first
check to see if an entry like the one entered by the user existed in the
exceptions table. If it does, I replace what they typed with the value from
the exceptions table, if it was not these I used the conversion that fredg
has already provided. I then also provided an option where the user could
make a new entry in the exceptions table on the fly so that new exceptions
would be handeled.

I also built an interface that would allow admin users to manage the list of
exceptions so that as the list got larger and larger unnecessary entries
could be removed, etc.

I takes some extra work but if you really need or want this kind of
functionality, it is doable.
 
Back
Top