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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Table Input Mask to capitalize the first letter of each word .

Status
Not open for further replies.

MikeFL

Programmer
Jul 12, 2002
58
US

Example sentence: REPLACE ROD BEARINGS

I’ve tried this: >C<???????????????????????

and I get this: Replace rod bearings

What I need is this: Replace Rod Bearings

Can this be accomplished using an input mask in a table?

And if so can someone help me in writing it?

I've looked everywhere!
 
Some years back I found this.... (not in this century) ;-)
I do not know who to credit for the invention, but perhaps it can be of some use to you.


Function Proper(x)
' Capitalise first letter of every word in a field.
' Use in an event procedure in AfterUpdate of control;
' for example, [Last Name] = Proper([Last Name]).
' Names such as O'Brien and Wilson-Smythe are properly capitalised,
' but MacDonald is changed to Macdonald, and van Buren to Van Buren.
' Note: For this function to work correctly, you must specify
' Option Compare Database in the Declarations section of this module.
Dim Temp$, c$, OldC$, I As Integer
If IsNull(x) Then
Exit Function
Else
Temp$ = CStr(LCase(x))
' Initialize OldC$ to a single space because first
' letter needs to be capitalised but has no preceding letter.
OldC$ = " "
For I = 1 To Len(Temp$)
c$ = Mid$(Temp$, I, 1)
If c$ >= "a" And c$ <= "z" And (OldC$ < "a" Or OldC$ > "z") Then
Mid$(Temp$, I, 1) = UCase$(c$)
End If
OldC$ = c$
Next I
Proper = Temp$
End If
End Function

Herman

They say that crime doesn't pay... does that mean my job is a crime?
 
Thanks Ken Reay & Herman, both answers worked!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top