Suggestion for input mask for TextBox

J

John S. Ford, MD

What would the simplest input mask be if I want the user to type in a last
name the first letter of which is capitalized with the rest in lower case
ie. I also want the data entered into the underlying table to be formatted
the same way.

George
John
Ralph

Thanks in advance!
John
 
J

John Vinson

John S. Ford said:
What would the simplest input mask be if I want the user to type in a last
name the first letter of which is capitalized with the rest in lower case
ie. I also want the data entered into the underlying table to be formatted
the same way.

An Input Mask is a tool of very limited capacity: this is one of the things
it cannot do!

Consider such names as "de la Cruz" and "MacDonald". You really don't want
to force names into proper case anyway!

What I've sometimes done is put the following VBA code in the AfterUpdate
event of a name textbox. It will convert any entry in all lower case (only)
to Proper Case. This requires a form, tables have no usable events:

Private Sub txtLastName_AfterUpdate()
If StrComp(Me!txtLastName, LCase(Me!txtLastName), 0) = 0 Then
Me!txtLastName = StrConv(Me!txtLastName, vbProperCase)
End If
End Sub

John W. Vinson
 
J

John S. Ford, MD

Thanks John. That's very helpful!

John

"> An Input Mask is a tool of very limited capacity: this is one of the
things
 
Top