Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capital Letters 3

Status
Not open for further replies.

Daf99

Technical User
Mar 9, 2000
3
GB
I stole the following code some time ago, and wonder is there a code that would capitalise the first letter of every word?Function CapitalizeFirst(Str)<br>
<br>
<br>
' Make first letter in field uppercase; leave other<br>
' letters as typed.<br>
Dim strTemp As String<br>
strTemp = Trim(Str)<br>
CapitalizeFirst = UCase(Left(strTemp, 1)) & Mid(strTemp, 2)<br>
<br>
End Function<br>
<br>
<br>
<br>
Private Sub Pals_AfterUpdate()<br>
<br>
' Capitalize first letter in Pals.<br>
<br>
If Not (IsNull(Me!Pals)) Then<br>
Me!Pals = CapitalizeFirst((Me!Pals))<br>
End If<br>
<br>
End Sub<br>
<br>
<br>
I would be thankful for any help.<br>
<br>
<br>

 
I think it's in nwind or solutions.mdb, Utility functions, called Proper()<br>
--Jim
 
Public Function ConvertUpper(Value)<br>
<br>
ConvertUpper = UCase(Left(Value, 1)) & Right(Value, Len(Value) - 1)<br>
<br>
End Function<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
Hi Jim & Doug<br>
<br>
<br>
Jim<br>
<br>
Soulutions, was were I found this code, but I counld not find the &quot;Proper()&quot; mentioned I did a search on all of Northwinds & Soultions. The only thing I found was it can be done using (StrConv) but with limited knowledge I don't know how.<br>
<br>
Doug<br>
<br>
I tried putting your code in place of mine, but I got an error come up on &quot;Value&quot;, there is no doubt something I have missed.<br>
<br>
Thankyou<br>
<br>
Dave
 
I found the Proper function <br>
It's in the \Office\Samples\orders.mdb<br>
inside the &quot;UtilityFunctions&quot; module<br>
Or listed below<br>
---------------------------------------------------<br>
Function Proper(strToChange As String) As String<br>
' Converts string to Proper case<br>
On Error Resume Next<br>
Proper = StrConv(strToChange, vbProperCase)<br>
End Function<br>
<br>
Sorry about the Convert thing<br>
I don't know where I dug it up at.<br>
<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
Doug<br>
<br>
Thanks very much I used the above and it worked find<br>
<br>
Jason
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top