This may not be the best way but will work.
Public Sub CapFirstLetter()
Dim obj_Conn As ADODB.Connection
Set obj_Conn = CodeProject.Connection
Dim obj_RS As ADODB.Recordset
Set obj_RS = New ADODB.Recordset
obj_RS.Open "SELECT ID, ClientName FROM BM_tblClientSystemNames",
obj_Conn, adOpenStatic, adLockOptimistic
Dim ary_SplitField() As String
Dim str_SplitField As String
Dim str_Char As String
Dim i As Integer
Do Until obj_RS.EOF
str_SplitField = obj_RS(1).Value
ary_SplitField = Split(str_SplitField, " ")
For i = 0 To UBound(ary_SplitField)
If Len(ary_SplitField(i)) > 0 Then
str_Char = UCase(Mid(ary_SplitField(i), 1, 1))
ary_SplitField(i) = str_Char & Mid(ary_SplitField(i), 2)
End If
Next
str_SplitField = Join(ary_SplitField, " ")
obj_RS(1) = str_SplitField
obj_RS.Update
obj_RS.MoveNext
Loop
If obj_RS.State <> 0 Then obj_RS.Close
Set obj_RS = Nothing
If obj_Conn.State <> 0 Then obj_Conn.Close
Set obj_Conn = Nothing
End Sub
Bryan Martin
(e-mail address removed)
Daniel P said:
Hello,
I have a Table where info has been entered any way the user felt like.
How can I easily change the format the a specific column info so that they
have the first letter of each word capitalized only?