Formating Text

T

Tim

My database has a table with separate fields to record a
customer's forename and surname. Is there a way to
convert whatever is entered into proper case? I have
tried using the input mask >L<?????????????? but if anyone
enters two forenames, or the surname is double-barrelled,
the second part does not start with a capital letter.
 
S

Steve Schapel

Tim,

On the AfterUpdate event of the control on your Form, put code like
this...
Me.Surname = StrConv(Me.Surname, 3)

This will sort out the 2 forenames situation. There will be problems
with this, for example
de Longhi will be converted to De Longhi
McDonald will be converted to Mcdonald
Botheringham-Smythe will be converted to Botheringham-smythe
It is very difficult to cover all of these exceptions, but there is
code at http://www.mvps.org/access/strings/str0008.htm that does a
good job.

- Steve Schapel, Microsoft Access MVP
 
T

TC

Weeel ... definitely!

It don't make sense to use a fixed constant, when a symbolic equivalent is
there for the taking :)

Eg. if the value change from version to version, vbProperCase keeps on
truckin', but 3 will fall in a heap (in that case).

Happy xmas,
TC
 

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