input mask to capitalise first letter of surname

G

Guest

How do I set the properities of a surname field in a table to create an input
mask that will capitalise the first letter of each surname?
 
G

Guest

LOL, no problem. For the future, search the access help file for "Input
Mask". You'll find some good examples.
 
G

Guest

Brilliant xRoachx!!! I've been tearing my hair out for the past few days
over this one! Thanks again from the "nearly bald lady"!!!
 
G

Guest

Try the following:

The L indicates the first digit is required and must be a letter and the >
ensures it is capitalized. The ? indicates the following digits are optional
but are lower case letters. Also, be sure to include enough ? for the length
of your field.
 
J

John Vinson

How do I set the properities of a surname field in a table to create an input
mask that will capitalise the first letter of each surname?

xRoach's suggestion will work...partially. It will capitalize only the
first LETTER of the field, and lowercase the rest - and that only as a
display, not changing what's actually stored. This will give you
values like Mcdonald (for McDonald), Van der steen (for van der
Steen), and Smith-hawken (for Smith-Hawken).

You may want to use some VBA code in the Form control's AfterUpdate
event ( you do need a form, tables have no usable events):

Private Sub txtSurname_AfterUpdate()
If StrComp(Me!txtSurname, LCase(Me!txtSurname), 0) <> 0 Then
Me!txtSurname = StrConv(Me!txtSurname, vbProperCase)
End If
End Sub

This will leave mixed case fields alone, but will take names in all
lower case and convert them to Proper Case (Each Word Capitalized,
Including Hyphenated-names).

John W. Vinson[MVP]
 

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