How to make all caps to Initial Capitols 
Author Message
 How to make all caps to Initial Capitols

In excel there is a function for changing all typing to First letter
capitalized of each word and the rest lower case called Proper.  Used like
this:

=Proper(C4)

How do I make this function available in access?

Thanks in advance,

Doyle60



Tue, 05 Sep 2000 03:00:00 GMT  
 How to make all caps to Initial Capitols

I am not sure if you were wanting to convert a single word or several words at
a time. This is a very simple conversion function that just converts one word:

Public Function gProperCase(String1 As String) As String
    Dim i as Integer
    Dim NewString as String

    i = Len(String1)
    If i > 1 Then
        NewString = Ucase(Left(String1,1)) & Right(String1, i - 1)
    ElseIf i Then
         NewString = Ucase(String1)
    Else
        NewString = String1
    End If
    gProperCase = NewString
End Function

This is one I use sometimes that can convert entire sentences to Proper:

Public Function gChgProper(String1 As String) As Variant
    'This function converts String1 to proper Case
    'it capitalizes after every ","  "."  "/"  "&"  " "
    Dim intPos As Integer
    Dim intLen As Integer
    Dim strValue As String
    Dim i As Integer
    Dim sChr As String
    Const cPeriod As Integer = 46
    Const cSlash As Integer = 47
    Const cAmper As Integer = 38
    Const cComma As Integer = 44
    Const cSpace As Integer = 32
    Dim arrChr(4) As Integer

    arrChr(0) = cPeriod
    arrChr(1) = cSlash
    arrChr(2) = cAmper
    arrChr(3) = cComma
    arrChr(4) = cSpace

    On Error GoTo gChgProperErr

    gChgProper = ""
    If IsNull(String1) Then
        GoTo gChgProperExit
    End If
    strValue = String1
    strValue = LCase(Trim(strValue))
    intLen = Len(strValue)
    If intLen = 0 Then
        gChgProper = ""
    Else
        For i = 0 To 4
            sChr = Chr$(arrChr(i))
            strValue = UCase(Left(strValue, 1)) & Mid(strValue, 2)
            intPos = InStr(2, strValue, sChr, vbTextCompare)
            Do Until intPos = 0
                strValue = Left(strValue, intPos) & UCase(Mid(strValue, intPos
+ 1, 1)) & Mid(strValue, intPos + 2)
                intPos = InStr(intPos + 1, strValue, sChr, vbTextCompare)
            Loop
        Next
        gChgProper = strValue
    End If
gChgProperExit:
    Exit Function
gChgProperErr:
    'Error code here
    Resume gChgProperExit
End Function

This doesn't catch names like "McCartney" or abbreviations like "DAO".  That
would require a bit more coding.
If your original question was how to access the Proper function in Exel and
use it in Access....You got me.  I don't think you can.  If anyone has a
better function, I would love to use it.

Hope this helps,

BP

Reply to Group only please.

Quote:

> In excel there is a function for changing all typing to First letter
> capitalized of each word and the rest lower case called Proper.  Used like
> this:

> =Proper(C4)

> How do I make this function available in access?

> Thanks in advance,

> Doyle60



Wed, 06 Sep 2000 03:00:00 GMT  
 How to make all caps to Initial Capitols

What happend to StrConv(String, vbProperCase)??

HTH
LMH rogue(at)channel1 dot com
WWW http://www.channel1.com/users/rogue
Reply address foiled to fool spam-bots. Remove the obvious.
Spammers read this: US CODE title 47, chapter 5, sub-chapter 2,
section 227(b)(1)(C), section 227(b)(3)(B) and section 227(b)(3)(C)
You know you've had too much coffee when...
   Charles Manson thinks you need to calm down.



Wed, 06 Sep 2000 03:00:00 GMT  
 How to make all caps to Initial Capitols



Quote:
> In excel there is a function for changing all typing to First letter
> capitalized of each word and the rest lower case called Proper.  Used like
> this:

> =Proper(C4)

> How do I make this function available in access?

StrConv() will do the job.  Check it out in online help. -- Ken


Wed, 06 Sep 2000 03:00:00 GMT  
 How to make all caps to Initial Capitols

Thanks for the answer on how to capitalize the first letter of a string and
lower case the rest.  I may use it.  But I really want to capitalize ALL words
in the string and lower case the rest.

Doyle60

Quote:
>Public Function gProperCase(String1 As String) As String
>    Dim i as Integer
>    Dim NewString as String

>    i = Len(String1)
>    If i > 1 Then
>        NewString = Ucase(Left(String1,1)) & Right(String1, i - 1)
>    ElseIf i Then
>         NewString = Ucase(String1)
>    Else
>        NewString = String1
>    End If
>    gProperCase = NewString
>End Function



Wed, 06 Sep 2000 03:00:00 GMT  
 How to make all caps to Initial Capitols

Hi

From somewhere on the net I downloaded "NeatCode.mdb". I am sure it is a
Public Domain app. Probably I got it from the MS Web Site. It contains
several "Proper" functions, (and a whole bunch of other useful functions),
one of which is designed to do just what you want.
I expect you can find the newest latest shiniest version by doing a search
on the net. It's likely some of the functions found in my copy are redundant
in Access max(version number).
If you can't find, but want it, e-mail me and I'll send it off to you. It
about 600 000 bytes. If you have a slow connection, I'll zip it for you.
If I'm mistaken and this is someone's exclusive property, please, let me
know about that too, and I'll wipe it.
--
Lyle Fairfield


Quote:
>Thanks for the answer on how to capitalize the first letter of a string and
>lower case the rest.  I may use it.  But I really want to capitalize ALL
words
>in the string and lower case the rest.

>Doyle60

>>Public Function gProperCase(String1 As String) As String
>>    Dim i as Integer
>>    Dim NewString as String

>>    i = Len(String1)
>>    If i > 1 Then
>>        NewString = Ucase(Left(String1,1)) & Right(String1, i - 1)
>>    ElseIf i Then
>>         NewString = Ucase(String1)
>>    Else
>>        NewString = String1
>>    End If
>>    gProperCase = NewString
>>End Function



Wed, 06 Sep 2000 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Strings - how can I convert to Initial Caps?

2. Initial Caps

3. Can initial form be made public?

4. Making A Field Change To All Caps

5. Making Vb4 look for the caps lock key

6. Caps in CAP and Small in small??? How?

7. Making my programs available to the world and making my fortune (grin)

8. Making the Form invisible but making the controls seen

9. Restrict Windows File Dialog to Initial Folder?

10. parsing name field into first and last discarding middle initial

11. How to force initial page layout info for reports

12. Setting Initial Value In Combo Box

 

 
Powered by phpBB® Forum Software