I have a textbox for a name. I would like to put an input mask to force a
capital letter for the first letter in the name, but I have a problem with
names where there is another capital in it. If I do >L<LL it forces the
last two letters to be lowercase, even if I want it to be capital. Any help
would be really appreciated.
Troy W.
DL - 05 May 2005 10:04 GMT
Are you using names such as;
1) McAfee
2) Lawson Martin
3) Lawson-Martin
If using only (2) not to much problem, but a combination - difficult.
> I have a textbox for a name. I would like to put an input mask to force a
> capital letter for the first letter in the name, but I have a problem with
[quoted text clipped - 3 lines]
>
> Troy W.
DL - 05 May 2005 22:07 GMT
As an afterthought, and in addition to John's post, as user exits the field,
a msg box that shows the text and requires a yes/no response.
> Are you using names such as;
> 1) McAfee
[quoted text clipped - 10 lines]
> >
> > Troy W.
John Vinson - 05 May 2005 18:56 GMT
>I have a textbox for a name. I would like to put an input mask to force a
>capital letter for the first letter in the name, but I have a problem with
[quoted text clipped - 3 lines]
>
>Troy W.
Input masks simply are not capable of handling the complexity of name
capitalization.
What I do instead is use a bit of VBA code in the AfterUpdate event of
the name textbox, to see if the name is all lower case; if so it uses
the builtin StrConv() function to convert it to Proper Case (Each Word
Capitalized). If it's already mixed case, I'll assume that the user
wants it that way (McArthur or de la Cruz or Jones-Smith for example):
Private Sub txtLastName_AfterUpdate()
If StrComp(txtLastName, LCase(txtLastName), vbBinaryCompare) = 0 Then
Me!txtLastname = StrConv(Me!txtLastName, vbProperCase)
End If
End Sub
John W. Vinson[MVP]