Stuart McLachlan
stuart at lexacorp.com.pg
Sun Jun 15 17:42:20 CDT 2003
On 15 Jun 2003 at 14:06, Klos, Susan wrote:
> I guess the subject tells it all. I have a query that contains school names
> which are almost all upper case. I would like to set them to proper case in
> the query.
As Gustav said strConv() can do it on a basic level. It is however a
bit limited in what it regards as delimiters (it doesn't handle names
like O'Connor or brackets etc. Here's the one I use which you you
modify to define your own delimiters, just put them in the
"whitespace" string:
Function Propercase(words As String) As String
Dim loopcount As Long
Dim whitespace As String
Dim newword As Boolean
Dim strChar As String
whitespace = " .,:-;([{}])`'" & Chr$(34)
strlowers = "abcdefghijklmnopqrstuvwxyz"
words = LCase$(words)
newword = True
For loopcount = 1 To Len(words)
strChar = Mid$(words, loopcount, 1)
If newword And InStr(strlowers, strChar) > 0 Then
Mid$(words, loopcount, 1) = Chr$(Asc(strChar) - 32)
End If
If InStr(whitespace, strChar) > 0 Then
newword = True
Else
newword = False
End If
Next
Propercase = words
End Function
--
Lexacorp Ltd
http://www.lexacorp.com.pg
Information Technology Consultancy, Software Development,System
Support.