changing UPPERCASE to ProperCase 
Author Message
 changing UPPERCASE to ProperCase

How can I do this with existing data within an existing table and all
future data entry for this table.  I use a form for the data entry.
The existing table has about 10000 records.  I tried using the "after
update" field in the properties box for the form and I was unsuccessful:

Using:

 Me!guest_last_name=StrConv(Me!guest_last_name, vbProperCase)

where "guest_last_name" is the field I wish to convert.

IF I can get this method to work, it still seems inefficient because I
will have to put this syntax in every field I wish to convert.  And
that still doesn't affect the existing data in the table.  OR DOES IT?
My experience with syntax is limited so please pardon the simplicity of
my question.
Thank you.

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Sat, 12 Oct 2002 03:00:00 GMT  
 changing UPPERCASE to ProperCase

Quote:

> How can I do this with existing data within an existing table and all
> future data entry for this table.  I use a form for the data entry.
> The existing table has about 10000 records.  I tried using the "after
> update" field in the properties box for the form and I was unsuccessful:

> Using:

>  Me!guest_last_name=StrConv(Me!guest_last_name, vbProperCase)

> where "guest_last_name" is the field I wish to convert.

> IF I can get this method to work, it still seems inefficient because I
> will have to put this syntax in every field I wish to convert.  And
> that still doesn't affect the existing data in the table.  OR DOES IT?
> My experience with syntax is limited so please pardon the simplicity of
> my question.

  If you wish to change the data already in your table, you could
Execute an SQL update query on your table:

UPDATE YourTable SET guest_last_name = StrConv(guest_last_name, 3);

...3 is the constant for vbProperCase.  Do this to each field you want
to change and all yer records are now proper.
  To assure that new records are recorded with proper case, you will
need to use StrConv on each field when a record is added/edited.  I
wouldn't consider that inefficient - data validation/conversion is more
efficient than having to deal with a messy db, because users (and the
characters they type) are unpredictable.  To provide specific detail on
how to implement that, you'd need to post more detail on how you
display/edit/add data with your form (e.g., Data Control or code,
DAO/ADO, display info in TextBoxes, grid, etc).
--
Jim in Cleveland
If you're writing to me, in my address
change "REAL_Address.see.below" to "worldnet.att.net"
 ((("What's so funny 'bout peace, love & understanding?" - Nick Lowe)))



Sun, 13 Oct 2002 03:00:00 GMT  
 changing UPPERCASE to ProperCase
Here is a function that I like to use that converts a string to proper case
while taking into consideration certain special characters:

Public Function TitleCase(InString As String) As String
    'Formats string as title case
    'Note: StrConv(InString, vbProperCase) could provide almost the same
functionality
    '      except that it doesn't check for special characters
(.,/\;:-!?[]()#)

    Dim OutString As String, CurrentLetter As String
    Dim CurrentWord As String, TCaps As String
    Dim StrCount As Integer, i As Byte

    OutString = ""

    If Len(InString) = 0 Then
        TitleCase = ""
        Exit Function
    End If

    CurrentWord = ""

    For StrCount = 1 To Len(InString)
        CurrentLetter = Mid(InString, StrCount, 1)
        CurrentWord = CurrentWord + CurrentLetter
        If InStr(" .,/\;:-!?[]()#", CurrentLetter) <> 0 Or StrCount =
Len(InString) Then
            TCaps = UCase(Left(CurrentWord, 1))
            For i = 2 To Len(CurrentWord)
                TCaps = TCaps & LCase(Mid(CurrentWord, i, 1))
            Next
            OutString = OutString & TCaps
            CurrentWord = ""
        End If
    Next

    TitleCase = OutString

End Function



Sun, 13 Oct 2002 03:00:00 GMT  
 changing UPPERCASE to ProperCase
Strikes me as extremely inefficient!

What problems did you encounter with special characters and StrConv that
made you feel you had to do something like this?

--

Doug Steele, Microsoft Access MVP
Beer, Wine and Database Programming. What could be better?
Visit "Doug Steele's Beer and Programming Emporium"
http://I.Am/DougSteele/


Quote:
> Here is a function that I like to use that converts a string to proper
case
> while taking into consideration certain special characters:

> Public Function TitleCase(InString As String) As String
>     'Formats string as title case
>     'Note: StrConv(InString, vbProperCase) could provide almost the same
> functionality
>     '      except that it doesn't check for special characters
> (.,/\;:-!?[]()#)

>     Dim OutString As String, CurrentLetter As String
>     Dim CurrentWord As String, TCaps As String
>     Dim StrCount As Integer, i As Byte

>     OutString = ""

>     If Len(InString) = 0 Then
>         TitleCase = ""
>         Exit Function
>     End If

>     CurrentWord = ""

>     For StrCount = 1 To Len(InString)
>         CurrentLetter = Mid(InString, StrCount, 1)
>         CurrentWord = CurrentWord + CurrentLetter
>         If InStr(" .,/\;:-!?[]()#", CurrentLetter) <> 0 Or StrCount =
> Len(InString) Then
>             TCaps = UCase(Left(CurrentWord, 1))
>             For i = 2 To Len(CurrentWord)
>                 TCaps = TCaps & LCase(Mid(CurrentWord, i, 1))
>             Next
>             OutString = OutString & TCaps
>             CurrentWord = ""
>         End If
>     Next

>     TitleCase = OutString

> End Function



Mon, 14 Oct 2002 03:00:00 GMT  
 changing UPPERCASE to ProperCase
Yeah, you are probably right that my code is very inefficient but StrConv
does not have the exact same functionality. For example:

? StrConv("hello/world", vbProperCase)
Hello/world

? TitleCase("hello/world")
Hello/World

While this usually isn't an issue for most written English phrases, it is
still useful for special purposes. Maybe there is a better way that first
lets StrConv handle the string and then it uses InStr and Replace a couple
of times to check for these characters. Do you have any suggestions?

Jack



Quote:
> Strikes me as extremely inefficient!

> What problems did you encounter with special characters and StrConv that
> made you feel you had to do something like this?



Tue, 15 Oct 2002 03:00:00 GMT  
 changing UPPERCASE to ProperCase
I see what you're trying to do (although I can't think of any cases where
I'd want to do it! <g>)

Yeah, I'd use StrConv, then look for your special characters (and the letter
after them)

--

Doug Steele, Microsoft Access MVP
Beer, Wine and Database Programming. What could be better?
Visit "Doug Steele's Beer and Programming Emporium"
http://I.Am/DougSteele/


Quote:
> Yeah, you are probably right that my code is very inefficient but StrConv
> does not have the exact same functionality. For example:

> ? StrConv("hello/world", vbProperCase)
> Hello/world

> ? TitleCase("hello/world")
> Hello/World

> While this usually isn't an issue for most written English phrases, it is
> still useful for special purposes. Maybe there is a better way that first
> lets StrConv handle the string and then it uses InStr and Replace a couple
> of times to check for these characters. Do you have any suggestions?

> Jack



> > Strikes me as extremely inefficient!

> > What problems did you encounter with special characters and StrConv that
> > made you feel you had to do something like this?



Tue, 15 Oct 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. How to change a string to ProperCase

2. Macro to change uppercase to mixed case

3. How do I change a pressed key to uppercase

4. Propercase

5. ProperCase Function/Routine

6. Prob#2, ProperCase issue

7. uppercase and lower case problems

8. How to make the first letters uppercase ?

9. Convert a number to a character (Uppercase)

10. Uppercase to Mixed Case Conversion

11. Convert a number to a character (Uppercase)

12. Converting all text in uppercase in Excel

 

 
Powered by phpBB® Forum Software