Sentence Case

M

Mark Bruso

Hi

Does anyone have a Sentence Case function they would be willing to share?

Mark
Portland, OR
 
C

Cheryl Fischer

It is the StrConv() function, using the vbProperCase argument (or its
number: 3 when using in a query)

strConvertedText = StrConv("WILLIAM JEFFERSON CLINTON", vbProperCase)

ConvertedText: StrConv("WILLIAM JEFFERSON CLINTON", 3)
 
W

WSF

In Word, for example, Sentence Case capitalises the first letter of the
first word only of a sentence - presumably a string terminated by a period
or full stop which itself is followed by a space(s), line / para feed etc.

Proper Case caps the first letters of all words in a sentence.
Access does not appear to offer these as standard formatting functions.

HTH

WSF
 
W

WSF

In Word, for example, Sentence Case capitalises the first letter of the
first word only of a sentence - presumably a string terminated by a period
or full stop which itself is followed by a space(s), line / para feed etc.

Proper Case caps the first letters of all words in a sentence.
Access does not appear to offer these as standard formatting functions.

HTH

WSF
 
J

John Vinson

In Word, for example, Sentence Case capitalises the first letter of the
first word only of a sentence - presumably a string terminated by a period
or full stop which itself is followed by a space(s), line / para feed etc.

For example:

In word, for example, sentence case capitalises the first letter of
the first word only of a sentence - presumably a string terminated by
a period or full stop which itself is followed by a space(s), line /
para feed etc. You may consider this good english, but i fear that i
do not...
 
W

WSF

Your point being?

WSF

John Vinson said:
etc.

For example:

In word, for example, sentence case capitalises the first letter of
the first word only of a sentence - presumably a string terminated by
a period or full stop which itself is followed by a space(s), line /
para feed etc. You may consider this good english, but i fear that i
do not...
 
P

PC Datasheet

You are right, there is no Sentence Case in Access.

MsgBox StrConv("WILLIAM JEFFERSON CLINTON", vbProperCase)

MsgBox StrConv("WILLIAM JEFFERSON CLINTON", 3)

Both of the above give William Jefferson Clinton which is not sentence case.
Access calls this Proper Case while Word calls it Title Case.

Grammatically, a sentence begins with a letter and ends in a period, question
mark or exclamation point. If another sentence follows, a space must follow
whichever punctuation mark ended the previous sentence. So if you want sentence
case, you must create a user-defined function that follows these rules of
grammar. Your function would follow these steps:
1. Use StrConv(Left("YourString",1),vbProperCase) to capitalize the the first
letter
2. Use the InStr function to determine if there is a second sentence.
InStr("YourString",". or ? or ! + space + Asc(x) = Between 65 and 90 or Asc(X1)
= Between 97 and 122)
3. If InStr in 2 returns a number other than 0, there is a second sentence and
you capitalize X1 with:
StrConv(Mid("MyString",Position Of X1,1),vbProperCase)
4. Repeat steps 2 and 3 until InStr in 2 dies not return a number other than 0.
This means you have found all the sentences.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top