Only Allow Caps

Crilen007

Uhm, Title... *shrug*
Local time
Today, 10:23
Joined
Jun 13, 2003
Messages
531
I have a form where users enter things.

I want to allow ONLY Capital letters and numbers.

Anyone have any ideas? the fields are never more than 3 characters long.

Usually formated as such:

69k
79g
110
345

etc...

Any ideas? Oh, and it has to be like this in the table, not just appear this way.

Thanks all for your replies!
 
use an InputMask with a "\" "to cause the character that follows to be displayed as the literald character."

example:
Input Mask:
0\Ø0\w

sample data:
3Ø4w

In this example I wanted to show the phase and the wattage. I wanted to also store this information in the table.

For your situation something like

99L
or
00L

depends on which fields you want to be optional or required. It's amusing that in your example you used lowercase letters.


-Mike
 
Last edited:
I used lowercase because that is what is commonly entered.

Also, they can be formatted like

333 - 3 numbers
12G - 2 letters and a number
LCO - 3 letters.

I need it all to be caps if its a letter.
 
Last edited:
You can convert the keyed data into uppercase. I use this in the AfterUpdate event of a text box named "tbFirstName". It will convert the data [which is saved to the table] to the upper case after the user has moved the focus to another object [button, text box, etc].

Code:
Private Sub tbFirstName_AfterUpdate()
On Error GoTo Err_tbFirstName_AfterUpdate
    
    tbFirstName = Trim(tbFirstName)
    'tbFirstName = StrConv(tbFirstName, vbProperCase)
    tbFirstName = StrConv(tbFirstName, vbUpperCase)
    
Exit_tbFirstName_AfterUpdate:
    Exit Sub
    
Err_tbFirstName_AfterUpdate:
    MsgBox Err.Number & " - " & Err.Description
    Resume Exit_tbFirstName_AfterUpdate
    
End Sub
 
Haha that was too easy =(

I should have known that one.

Thanks Ghud, mucho appreciated.
 
wow... yea that was. heh. I guess I too it too simplistic of a method with the input mask. but I like the procedural solution - works for a much wider range of fields.
 

Users who are viewing this thread

Back
Top Bottom