(Q) How can I capitalize the first character of each word in a field/string?
(A) Under Access 97, you can use the StrConv function. For example,
StrConv("dev ashish", vbProperCase)
For Access 2.0, use the Proper function provided by Microsoft.
Function Proper(X)
Dim Temp$, C$, OldC$, i As Integer
If IsNull(X) Then
Exit Function
Else
Temp$ = CStr(LCase(X))
OldC$ = " "
For i = 1 To Len(Temp$)
C$ = Mid$(Temp$, i, 1)
If C$ >= "a" And C$ <= "z" And _
(OldC$ < "a" Or OldC$ > "z") Then
Mid$(Temp$, i, 1) = UCase$(C$)
End If
OldC$ = C$
Next i
Proper = Temp$
End If
End Function
|