Title Case

IainMac

New member
Local time
Today, 07:01
Joined
Jul 7, 2003
Messages
3
Is there any way to force text in a form field to be entered/displayed in title case?
This is for addresses where data entry is somewhat random in quality.
I have messed around with input masks, but haven't come up with a satisfactory answer
 
You can use the strConv() function. Search the archives here for details or look in help.
 
You can use the following code to automatically Title Case text entered in a text box as you enter it. Put the code on the On Key Press event.

--------

Static CapNext As Integer

Set myControl = Screen.ActiveControl
If myControl.Text = "" Then
KeyAscii = Asc(UCase$(Chr$(KeyAscii)))
CapNext = False
ElseIf KeyAscii = 32 Then '-Space = 32
CapNext = True
ElseIf CapNext Then
KeyAscii = Asc(UCase$(Chr$(KeyAscii)))
CapNext = False
End If

Exit Sub

--------
This is a tight little procedure that works well (and fast). Please note that it does not handle backspaces or special cases, e.g. Names McDonald, MacDonald, or Addresses NW. Not withstanding these limitations, our clients love this little routine.

We use some functions to handle these special cases on the Text Box's After Update Event.

If you would like to see these, please let me know.


Good Luck! If you have any questions, please let me know.
 

Users who are viewing this thread

Back
Top Bottom