Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Modify ALLCAPS memo field

Geek News

Modify ALLCAPS memo field
Shadow 11/13/2008 12:26:00 AM
I have a database with a memo field that has many entries entered as allcaps.
Is there a function similar to Pcase or vb language that would permit
modifying the allcaps data in the memo field to a modified 'Proper'
capitalization with only the first letter of a sentence or bullet
capitalized? The memo field can contain several sentences or several
numbered bullets.
Re: Modify ALLCAPS memo field
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_gmail.com> 11/13/2008 12:28:17 AM
Check the StrConv function.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Shadow" <Shadow[ at ]discussions.microsoft.com> wrote in message
news:698107D8-6475-451F-9AEF-584FF1A0001F[ at ]microsoft.com...
[Quoted Text]
>I have a database with a memo field that has many entries entered as
>allcaps.
> Is there a function similar to Pcase or vb language that would permit
> modifying the allcaps data in the memo field to a modified 'Proper'
> capitalization with only the first letter of a sentence or bullet
> capitalized? The memo field can contain several sentences or several
> numbered bullets.


Re: Modify ALLCAPS memo field
Shadow 11/13/2008 1:01:00 AM


"Douglas J. Steele" wrote:

[Quoted Text]
> Check the StrConv function.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "Shadow" <Shadow[ at ]discussions.microsoft.com> wrote in message
> news:698107D8-6475-451F-9AEF-584FF1A0001F[ at ]microsoft.com...
> >I have a database with a memo field that has many entries entered as
> >allcaps.
> > Is there a function similar to Pcase or vb language that would permit
> > modifying the allcaps data in the memo field to a modified 'Proper'
> > capitalization with only the first letter of a sentence or bullet
> > capitalized? The memo field can contain several sentences or several
> > numbered bullets.
>
>
>
I know about the StrConv function but do not know how to apply it to all the
words in a sentence (i.e. first word capitalized and all subsequent words
lower case). And then to stop it at the first period and restart it for the
second sentence.
Re: Modify ALLCAPS memo field
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_gmail.com> 11/13/2008 12:46:07 PM
Sorry, you're right. StrConv with the vbProperCase doesn't do what you're
looking for.

You'd have to write a function that used LCase to convert the whole thing to
lower case, then selectively use UCase to convert the first character to
upper case, as well as the first character after each period.

Something like the following untested air-code:

Function ProperCase(InputString As String) As String
Dim lngLoop As Long
Dim lngStringLength As String
Dim lngPeriod As Long
Dim strOutput As String

lngStringLength = Len(InputString)

strOutput = UCase(Left(InputString, 1)) & _
LCase(Mid(InputString, 2))

lngPeriod = InStr(strOutput, ".") + 1
Do While lngPeriod < lngStringLength
If Mid(strOutput, lngPeriod, 1) <> " " Then
Mid(strOutput, lngPeriod, 1) = UCase(Mid(strOutput, lngPeriod, 1))
lngPeriod = InStr(lngPeriod, strOutput, ".")
End If
lngPeriod = lngPeriod + 1
Loop

ProperCase = strOutput

End Function

It does have a problem in that it doesn't recognize exclamation points as
sentence ends.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Shadow" <Shadow[ at ]discussions.microsoft.com> wrote in message
news:D0421319-608E-401B-B6C9-AA6457418C50[ at ]microsoft.com...
[Quoted Text]
>
>
> "Douglas J. Steele" wrote:
>
>> Check the StrConv function.
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no private e-mails, please)
>>
>>
>> "Shadow" <Shadow[ at ]discussions.microsoft.com> wrote in message
>> news:698107D8-6475-451F-9AEF-584FF1A0001F[ at ]microsoft.com...
>> >I have a database with a memo field that has many entries entered as
>> >allcaps.
>> > Is there a function similar to Pcase or vb language that would permit
>> > modifying the allcaps data in the memo field to a modified 'Proper'
>> > capitalization with only the first letter of a sentence or bullet
>> > capitalized? The memo field can contain several sentences or several
>> > numbered bullets.
>>
>>
>>
> I know about the StrConv function but do not know how to apply it to all
> the
> words in a sentence (i.e. first word capitalized and all subsequent words
> lower case). And then to stop it at the first period and restart it for
> the
> second sentence.


Re: Modify ALLCAPS memo field
Shimon <MalcolmX[ at ]fromru.com> 11/13/2008 3:26:50 PM
Hi,
I think I saw a utility dB that has that functionality, I just looked it
up at Roger's access site, other developers utils. (I hade the page
saved so I can't give you the link)
and found this util called Proper Case Function

http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=166

Hope this helps,
Shimon

Douglas J. Steele wrote:
[Quoted Text]
> Sorry, you're right. StrConv with the vbProperCase doesn't do what you're
> looking for.
>
> You'd have to write a function that used LCase to convert the whole thing to
> lower case, then selectively use UCase to convert the first character to
> upper case, as well as the first character after each period.
>
> Something like the following untested air-code:
>
> Function ProperCase(InputString As String) As String
> Dim lngLoop As Long
> Dim lngStringLength As String
> Dim lngPeriod As Long
> Dim strOutput As String
>
> lngStringLength = Len(InputString)
>
> strOutput = UCase(Left(InputString, 1)) & _
> LCase(Mid(InputString, 2))
>
> lngPeriod = InStr(strOutput, ".") + 1
> Do While lngPeriod < lngStringLength
> If Mid(strOutput, lngPeriod, 1) <> " " Then
> Mid(strOutput, lngPeriod, 1) = UCase(Mid(strOutput, lngPeriod, 1))
> lngPeriod = InStr(lngPeriod, strOutput, ".")
> End If
> lngPeriod = lngPeriod + 1
> Loop
>
> ProperCase = strOutput
>
> End Function
>
> It does have a problem in that it doesn't recognize exclamation points as
> sentence ends.
>
Re: Modify ALLCAPS memo field
"Tony Toews [MVP]" <ttoews[ at ]telusplanet.net> 11/14/2008 6:41:24 AM
Shadow <Shadow[ at ]discussions.microsoft.com> wrote:

[Quoted Text]
>I have a database with a memo field that has many entries entered as allcaps.
> Is there a function similar to Pcase or vb language that would permit
>modifying the allcaps data in the memo field to a modified 'Proper'
>capitalization with only the first letter of a sentence or bullet
>capitalized? The memo field can contain several sentences or several
>numbered bullets.

There's also an API call available that will switch off the Caps Lock
key which you can insert in the controls GotFocus event.
HOWTO: Toggle the NUM LOCK, CAPS LOCK, and SCROLL LOCK Keys
http://support.microsoft.com/?kbid=177674

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Re: Modify ALLCAPS memo field
Shadow 11/17/2008 4:50:00 AM


"Douglas J. Steele" wrote:

[Quoted Text]
> Sorry, you're right. StrConv with the vbProperCase doesn't do what you're
> looking for.
>
> You'd have to write a function that used LCase to convert the whole thing to
> lower case, then selectively use UCase to convert the first character to
> upper case, as well as the first character after each period.
>
> Something like the following untested air-code:
>
> Function ProperCase(InputString As String) As String
> Dim lngLoop As Long
> Dim lngStringLength As String
> Dim lngPeriod As Long
> Dim strOutput As String
>
> lngStringLength = Len(InputString)
>
> strOutput = UCase(Left(InputString, 1)) & _
> LCase(Mid(InputString, 2))
>
> lngPeriod = InStr(strOutput, ".") + 1
> Do While lngPeriod < lngStringLength
> If Mid(strOutput, lngPeriod, 1) <> " " Then
> Mid(strOutput, lngPeriod, 1) = UCase(Mid(strOutput, lngPeriod, 1))
> lngPeriod = InStr(lngPeriod, strOutput, ".")
> End If
> lngPeriod = lngPeriod + 1
> Loop
>
> ProperCase = strOutput
>
> End Function
>
> It does have a problem in that it doesn't recognize exclamation points as
> sentence ends.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Shadow" <Shadow[ at ]discussions.microsoft.com> wrote in message
> news:D0421319-608E-401B-B6C9-AA6457418C50[ at ]microsoft.com...
> >
> >
> > "Douglas J. Steele" wrote:
> >
> >> Check the StrConv function.
> >>
> >> --
> >> Doug Steele, Microsoft Access MVP
> >> http://I.Am/DougSteele
> >> (no private e-mails, please)
> >>
> >>
> >> "Shadow" <Shadow[ at ]discussions.microsoft.com> wrote in message
> >> news:698107D8-6475-451F-9AEF-584FF1A0001F[ at ]microsoft.com...
> >> >I have a database with a memo field that has many entries entered as
> >> >allcaps.
> >> > Is there a function similar to Pcase or vb language that would permit
> >> > modifying the allcaps data in the memo field to a modified 'Proper'
> >> > capitalization with only the first letter of a sentence or bullet
> >> > capitalized? The memo field can contain several sentences or several
> >> > numbered bullets.
> >>
> >>
> >>
> > I know about the StrConv function but do not know how to apply it to all
> > the
> > words in a sentence (i.e. first word capitalized and all subsequent words
> > lower case). And then to stop it at the first period and restart it for
> > the
> > second sentence.
>
>
>
Thanks Douglas for your help. This saved a lot of retyping and can be used
to correct ALLCAPS data entry. There are a few problems like you mentioned
as explanation points but the conversion is infinitely better than 'StrConv'
and is acceptable for out application.
I modified 'Dim lngStringLength As String' to 'Dim lngStringLength As Long'.
The code works as long as there is a period at the end of the string of memo
comments.
Shadow
Re: Modify ALLCAPS memo field
Shadow 11/17/2008 7:59:02 AM


"Shadow" wrote:

[Quoted Text]
>
>
> "Douglas J. Steele" wrote:
>
> > Sorry, you're right. StrConv with the vbProperCase doesn't do what you're
> > looking for.
> >
> > You'd have to write a function that used LCase to convert the whole thing to
> > lower case, then selectively use UCase to convert the first character to
> > upper case, as well as the first character after each period.
> >
> > Something like the following untested air-code:
> >
> > Function ProperCase(InputString As String) As String
> > Dim lngLoop As Long
> > Dim lngStringLength As String
> > Dim lngPeriod As Long
> > Dim strOutput As String
> >
> > lngStringLength = Len(InputString)
> >
> > strOutput = UCase(Left(InputString, 1)) & _
> > LCase(Mid(InputString, 2))
> >
> > lngPeriod = InStr(strOutput, ".") + 1
> > Do While lngPeriod < lngStringLength
> > If Mid(strOutput, lngPeriod, 1) <> " " Then
> > Mid(strOutput, lngPeriod, 1) = UCase(Mid(strOutput, lngPeriod, 1))
> > lngPeriod = InStr(lngPeriod, strOutput, ".")
> > End If
> > lngPeriod = lngPeriod + 1
> > Loop
> >
> > ProperCase = strOutput
> >
> > End Function
> >
> > It does have a problem in that it doesn't recognize exclamation points as
> > sentence ends.
> >
> > --
> > Doug Steele, Microsoft Access MVP
> > http://I.Am/DougSteele
> > (no e-mails, please!)
> >
> >
> > "Shadow" <Shadow[ at ]discussions.microsoft.com> wrote in message
> > news:D0421319-608E-401B-B6C9-AA6457418C50[ at ]microsoft.com...
> > >
> > >
> > > "Douglas J. Steele" wrote:
> > >
> > >> Check the StrConv function.
> > >>
> > >> --
> > >> Doug Steele, Microsoft Access MVP
> > >> http://I.Am/DougSteele
> > >> (no private e-mails, please)
> > >>
> > >>
> > >> "Shadow" <Shadow[ at ]discussions.microsoft.com> wrote in message
> > >> news:698107D8-6475-451F-9AEF-584FF1A0001F[ at ]microsoft.com...
> > >> >I have a database with a memo field that has many entries entered as
> > >> >allcaps.
> > >> > Is there a function similar to Pcase or vb language that would permit
> > >> > modifying the allcaps data in the memo field to a modified 'Proper'
> > >> > capitalization with only the first letter of a sentence or bullet
> > >> > capitalized? The memo field can contain several sentences or several
> > >> > numbered bullets.
> > >>
> > >>
> > >>
> > > I know about the StrConv function but do not know how to apply it to all
> > > the
> > > words in a sentence (i.e. first word capitalized and all subsequent words
> > > lower case). And then to stop it at the first period and restart it for
> > > the
> > > second sentence.
> >
> >
> >
> Thanks Douglas for your help. This saved a lot of retyping and can be used
> to correct ALLCAPS data entry. There are a few problems like you mentioned
> as explanation points but the conversion is infinitely better than 'StrConv'
> and is acceptable for out application.
> I modified 'Dim lngStringLength As String' to 'Dim lngStringLength As Long'.
> The code works as long as there is a period at the end of the string of memo
> comments.
> Shadow

In order to fix the missing "." (period) problem, I added a 'Period Check'
after the Dim statements as follows:

Dim lngLoop As Long
Dim lngStringLength As Long
Dim lngPeriod As Long
Dim StrOut As String

If Right(InputString, 1 ) <> "." Then
InputString = InputString + "."
End If

lngStringLength = Len(InputString)

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net