Suggestion for input mask for TextBox

  • Thread starter Thread starter John S. Ford, MD
  • Start date Start date
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
 
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
 
Thanks John. That's very helpful!

John

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

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

Back
Top