Input mask to uppercase first letter of names when hyphenated

G

Guest

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.
 
G

Guest

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
 
G

Guest

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

If IsNull(Me.UserId) Then Exit Sub
 

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

Top