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

Automatically turn to capitals for each control 1

Status
Not open for further replies.

daveonion

Programmer
Aug 21, 2002
359
GB
Hi, i have a few controls which on input i want the letters to be capitals, i know i could insert the code in each control on key press but i believe this to be a long winded way, is there any way i could place the code once to format all controls, i have some code inserted below which i believe could work although its untested,

Dim strCharacter As String
Dim ctl As Control
For Each ctl In Forms![main input].Controls
If Right(ctl.Name, 4) = "main" Then
strCharacter = Chr(keyascii)
keyascii = Asc(UCase(strCharacter))
End If
Next ctl

any help once again would be appreciated
Dave
 
I have done this in the past by writing a function that takes the text box as a parameter and returns the amended ASCII character. Call the function on the keypress event for each text box. I also passed a boolean to determine whether upper or lower case would be returned.
 
Hi DavenMoyra, i don't suppose you have any examples of code to do this

Thanks

Dave
 
There is an easier way. Just type > in the format property of each text box that you need in upper case.

Maq [americanflag]
<insert witty signature here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top