Dale,
Pardon me, but I don't see how that will handle uppercase and lowercase
conversions for the rest of the string - unless you are suggesting the
poster passed the StrConv version to your function.
JOHN HOLDEN-SMYTHE
john holden-smythe
John Holden-Smythe
Should be all be returned as John Holden-Smythe if I understand the
poster's request. So I believe what you are saying is the user should call
your function this way
HyphenatedName(StrConv([SomeField],3))
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
Dale Fye said:
Formatting names is almost as much of a pain as formatting addresses.
Here is a simple function that will capitalize the first character of each
part of a hyphenated last name.
Public Function HyphenatedName(strLastName As Variant) As Variant
Dim intCharPos As Integer
If IsNull(strLastName) Then
HyphenatedName = Null
Exit Function
End If
intCharPos = InStr(strLastName, "-")
Mid(strLastName, 1, 1) = UCase(Mid(strLastName, 1, 1))
If intCharPos = 0 Then
HyphenatedName = strLastName
Else
Mid(strLastName, intCharPos + 1, 1) = UCase(Mid(strLastName,
intCharPos + 1, 1))
HyphenatedName = strLastName
End If
End Function
HTH
Dale
--
Don''t forget to rate the post if it was helpful!
Email address is not valid.
Please reply to newsgroup only.