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

Restricting only uppercasse input 1

Status
Not open for further replies.

230173

MIS
Jun 22, 2001
208
SG
Hi,

Is it possible to restrict somebody so he or she can only input uppercase data or convert the data in this field to uppercase. The length of the string is variable so a input mask isn't usefull.

Dwight

 
Take a look at the UCase function you can play with in the AfterUpdate event procedure of the control.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
You can force the text to upper case at the form level by using the ">" (no quotes) in the format property for the text box that users are entering data into.
 
dtay1132,

When using the ">" U must add a number of "&" or whatever to it but that's exactely the problem. The length of the string cannot be fixed. The user has to be able to give in a string of 3 characters, 5 characters, 10 characters,... BUT!!!! only in uppercase.

Dwight
 
As PHV mentioned, the easiest way is to use the UCase function in the AfterUpdate event.

The code will look something like this:
Code:
Private Sub MyControl_AfterUpdate()
  Me.MyControl = UCase(Me.MyControl)
End Sub

 
Hi, try this in the On Current event of your form. It makes use the the Tag Property found under the 'Other' tab of your control's properties. It is useful in including and excluding controls.

Private Sub Form_Current()

Dim ctl As Control

For Each ctl In Me.Controls

If ctl.ControlType = acTextBox Then

'if tag value = 1 then use Ucase

If ctl.Tag = 1 Then
ctl.Value = UCase(ctl.Value)
End If
End If
Next ctl

End Sub
 
use ">" (no quotes). but instead of using it on the textbox of the form, define it directly on the table the field is. You don't have to define a number of characters after the ">
 
Aleksjay,

Do you mean as a validation rule, input mask or format? I tried al of these but still no luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top