Capitalizing the first letter in a sentence.

G

Guest

Is it possible to automatically capitalize the first letter in a sentence? I
have searched the help topics in Access as well as the knowledge base at
Microsoft without success. I am using Access 2003.
 
G

Guest

I'm not familiar with a BuildIn function in Access, try this function, copy
it to a module, so all you have to is pass it the sentence and will return
capital letter for beginning of a sentence
===============================
Function CapBegOfSen(MyStr As String)
Dim I As Integer, MyFlag As Byte
If IsNull(MyStr) Or MyStr = "" Then
CapBegOfSen = ""
Exit Function
End If
MyFlag = True
For I = 1 To Len(MyStr)
If MyFlag = True And Mid(MyStr, I, 1) <> " " Then
CapBegOfSen = CapBegOfSen & UCase(Mid(MyStr, I, 1))
MyFlag = False
Else
CapBegOfSen = CapBegOfSen & Mid(MyStr, I, 1)
If Mid(MyStr, I, 1) = "." Then
MyFlag = True
End If
End If

Next I
End Function
==========================
To use it
=CapBegOfSen([Field Name])

I hope that will work out
 
G

Guest

I never used Functiosn before and have no clue as to how to use it.

Ofer said:
I'm not familiar with a BuildIn function in Access, try this function, copy
it to a module, so all you have to is pass it the sentence and will return
capital letter for beginning of a sentence
===============================
Function CapBegOfSen(MyStr As String)
Dim I As Integer, MyFlag As Byte
If IsNull(MyStr) Or MyStr = "" Then
CapBegOfSen = ""
Exit Function
End If
MyFlag = True
For I = 1 To Len(MyStr)
If MyFlag = True And Mid(MyStr, I, 1) <> " " Then
CapBegOfSen = CapBegOfSen & UCase(Mid(MyStr, I, 1))
MyFlag = False
Else
CapBegOfSen = CapBegOfSen & Mid(MyStr, I, 1)
If Mid(MyStr, I, 1) = "." Then
MyFlag = True
End If
End If

Next I
End Function
==========================
To use it
=CapBegOfSen([Field Name])

I hope that will work out
--
\\// Live Long and Prosper \\//
BS"D


Dimas Perez said:
Is it possible to automatically capitalize the first letter in a sentence? I
have searched the help topics in Access as well as the knowledge base at
Microsoft without success. I am using Access 2003.
 
G

Guest

First copy the function I provided you with into a module.
The job of this function to except a sentence and return it fixed with
capital letters

Now, if you know how to use Access functions (DlookUp , Ucase , replace ,
Cdbl , etc) then you can use the function just as any other build in
functions in Access.
==================
For example, to change a field value from text to number, you can use Cdbl

=Cdbl([TextFieldName])
====================
To add the sentence a capital letter, use the function name to return the
new string
=CapBegOfSen([Sentence field name])

Or you can create a query to return the original sentence together with the
new one

Select [Sentence field name] , CapBegOfSen([Sentence field name]) As
NewSentence From TableName

Or when you are in query design, add another field and write
NewSentence: CapBegOfSen([Sentence field name])
===================================

Now, it will be easier to explain if I know what you are trying to do with
the new sentence that come back

--
\\// Live Long and Prosper \\//
BS"D


Dimas Perez said:
I never used Functiosn before and have no clue as to how to use it.

Ofer said:
I'm not familiar with a BuildIn function in Access, try this function, copy
it to a module, so all you have to is pass it the sentence and will return
capital letter for beginning of a sentence
===============================
Function CapBegOfSen(MyStr As String)
Dim I As Integer, MyFlag As Byte
If IsNull(MyStr) Or MyStr = "" Then
CapBegOfSen = ""
Exit Function
End If
MyFlag = True
For I = 1 To Len(MyStr)
If MyFlag = True And Mid(MyStr, I, 1) <> " " Then
CapBegOfSen = CapBegOfSen & UCase(Mid(MyStr, I, 1))
MyFlag = False
Else
CapBegOfSen = CapBegOfSen & Mid(MyStr, I, 1)
If Mid(MyStr, I, 1) = "." Then
MyFlag = True
End If
End If

Next I
End Function
==========================
To use it
=CapBegOfSen([Field Name])

I hope that will work out
--
\\// Live Long and Prosper \\//
BS"D


Dimas Perez said:
Is it possible to automatically capitalize the first letter in a sentence? I
have searched the help topics in Access as well as the knowledge base at
Microsoft without success. I am using Access 2003.
 

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