Re: Input mask problem

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



On Wed, 6 Jul 2005 20:11:54 +0100, "Jack Isaacs"
<jack@xxxxxxxxxxxxxxxx> wrote:

>Hello All
>I'm sure this should be simple but I can't seem to get it. I need an input
>mask to make it so that the first character of each word entered in a text
>box is capitalised, and the rest are lower-case. All characters will be
>alpha-numeric, and there will be anything from 1 to 4 'names' - i.e. up to 3
>spaces. So the very first character needs to be capitalised, then the first
>character after a space needs to be capitalised.
>I would be very grateful for any help.
>Many thanks
>Les
>

Input masks have very limited capabilities; this is not amongst them.
You simply cannot do this with an Input Mask.

What you can do is to put VBA code in the textbox's AfterUpdate event,
using the StrConv() function to translate the user's input into Proper
Case (Each Word Capitalized):

Private Sub txtName_AfterUpdate()
' Only convert fields that are not already mixed case
' This will leave correct but not "proper" names such as
' MacDonald, van der Steen, and de Vargas undamaged
If StrComp(Me!txtName, LCase(Me!txtName), 0) = 0 Then
Me!txtName = StrConv(Me!txtName, vbProperCase)
End If
End Sub

John W. Vinson[MVP]
.



Relevant Pages

  • Re: Input Mask ..
    ... You could check for first character and last character is and "A" ... ENDIF ... not sortout a propper input mask. ... Prev by Date: ...
    (microsoft.public.fox.programmer.exchange)
  • Combo Box Auto Expand
    ... The combo box has an input mask. ... DISPLaYED is the same as the bound field, but it has underscores imbedded to ... When I type i the first character in the field - the first available value ...
    (microsoft.public.access.forms)
  • Input mask problem
    ... mask to make it so that the first character of each word entered in a text ... So the very first character needs to be capitalised, ... character after a space needs to be capitalised. ...
    (microsoft.public.access.forms)
  • Validation in Textbox
    ... I'm sure this is asked tons of time. ... How can we create the "mask" feature in vs.net? ... So that user can enter first character only as text, ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Input mask problem
    ... So the very first character needs to be capitalised, ... > Input masks have very limited capabilities; ... > using the StrConvfunction to translate the user's input into Proper ... > Private Sub txtName_AfterUpdate ...
    (microsoft.public.access.forms)