Input mask: Make entry capital and not "x"

G

Guest

I need to set the input mask for a one-letter field in a table to always make
it a capital, regardless of what the user types in, and to now allow the
letter "x".

thanks in advance,

Jerry
 
A

Allan Murphy

Jerry
Enter the following In the KeyPress event

KeyAscii = Asc(UCase(Char(KeyAscii)))

Allan Murphy

Email: (e-mail address removed)
 
G

Guest

Tried it but got an error: "Sub or function not defined" and the highlight
was over the "Char".

What did I do wrong?
 
P

Philo Hamel via AccessMonster.com

Char should be Chr.

So it should be this:

KeyAscii = Asc(UCase(Chr(KeyAscii)))

Later,
Philo
 
G

Guest

I took part of JWCrosby's question to mean that the letter "x" is not to
appear (assuming that "now" in the original question was supposed to be
"not"). I experimented with that, and have been able to generate an error
message in case of chr(88) or chr(120) (X or x), but cannot find a good way
to clear the text box. Even if I misread the intent of the original
question, how best to eliminate the letter if it is "X"?
 
P

Philo Hamel via AccessMonster.com

Sorry, I didn't read this one properly...
Sounds like you just need to change the properties of your textfield. Change
these properties:

Input mask : >L
Validation rule: <>"X"
Optional validation message: Letter X is not allowed

Hope this is what you were looking for ;)
Later,
Philo
 
G

Guest

Philo, you got it! Your solution gave me exactly what I needed. I apologize
for mistyping "now".

Thanks.

Jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top