Input mask to uppercase first letter of names when hyphenated

B

Bar4h

I need to know how to make the first letter uppercase on a name field, but
still be able to input a hyphen or another capital letter such as names like
McPhail.
 
O

Ofer

try this code, put it on the on exit of the field you want to change

Dim I As Integer
Dim MyCount As Integer
Dim UserName As String
MyCount = 0
For I = 1 To Len(Me.FieldName)
If MyCount <> 0 Then
UserName = UserName & Mid(Me.FieldName, I, 1)
Else
UserName = UserName & Format(Mid(Me.FieldName, I, 1), ">")
End If
MyCount = 1
If Mid(Me.FieldName, I, 1) = " " Then
MyCount = 0
End If

Next I
Me.FieldName.Value = UserName
 
O

Ofer

Add in the beginning of the code I sent you the line

If IsNull(Me.UserId) Then Exit Sub
 
Top