Setting text in text box to uppercase

D

Darren

I would like to find out how I could set all text that is entered in to my
text boxes in my form as uppercase. How do you do this?
 
S

Steve Schapel

Darren,

On the After Update event of each textbox on the form, you could put
code like this...
Me.NameOfTextbox = StrConv(Me.NameOfTextbox, 1)
 
O

Ofer

Hi
Look on help
it sould be format and either > or < symbol
one of them it for upper case ad the other for lower case
 
E

Eric Blitzer

Steve,

I assume "1" is for uppercase
What number would be used for
Lowercase
Propercase

Thanks

Eric
 
S

Steve Schapel

Ofer,

Good suggestion. This approach only affects the way the data is
displayed in this particular control. It does not affect the data itself.
 
T

TDR

i've been struggling with other issues and hoping for some replies - then I
saw this post and it was funny because i just finished having succes with
this but I was wondering whether i did it in a good way - i put the following
code in the on exit event of each text box:

Private Sub HouseholdLastName_Exit(Cancel As Integer)
Dim UCHouseholdLastName As String

If Me.Dirty Then
UCHouseholdLastName = HouseholdLastName.Value
UCHouseholdLastName = UCase(UCHouseholdLastName)
HouseholdLastName.Value = UCHouseholdLastName
End If

please let me know what you think.

TDR
 
J

John Vinson

i've been struggling with other issues and hoping for some replies - then I
saw this post and it was funny because i just finished having succes with
this but I was wondering whether i did it in a good way - i put the following
code in the on exit event of each text box:

Private Sub HouseholdLastName_Exit(Cancel As Integer)
Dim UCHouseholdLastName As String

If Me.Dirty Then
UCHouseholdLastName = HouseholdLastName.Value
UCHouseholdLastName = UCase(UCHouseholdLastName)
HouseholdLastName.Value = UCHouseholdLastName
End If

Um?

One step is all you need, not three:

Private Sub HouseholdLastName_AfterUpdate()
Me!HouseholdLastName = UCase(Me!HouseholdLastName)
End Sub

John W. Vinson[MVP]
 
Top