Validation rule - How do I force all Uppercase entry

G

Guest

I would like to force all uppercase entry into a table field, I can do it
with Input Mask property using >"LLLLL". I want to do the same thing only
using the Validation Rule property so that I can make my own message using
the Validation Text property.


Dennis B
 
R

Rick B

If you can force it to be all uppercase, why would you want to give them the
option of entering lowercase and then correct them? That does not seem very
efficient.

Why not just use the input mask as you have already discovered?
 
G

Guest

I would like to use the Input Mask property. The problem is that I would like
to be able to display my own message like the Validation Text property does.
I can not figure out if there is a way to change the Input Mask message to
read something different than the default message.

Dennis B
 
R

Rick Brandt

Dennis said:
I would like to force all uppercase entry into a table field, I can
do it with Input Mask property using >"LLLLL". I want to do the same
thing only using the Validation Rule property so that I can make my
own message using the Validation Text property.


Dennis B

Two step approach...

In the KeyPress event for the control...

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

That will convert characters to upper case as they type. To cover cases
where they might paste into the control add to the AfterUpdate event of the
control...

Me!TextBoxName = UCase(Me!TextBoxName)

Actually with this event the KeyPress one is somewhat redundant, but I like
to add it anyway as it gives the user immediate feedback that the field is
all caps. With these you would not need an input mask which are evil (IMO).
 
S

shalabh.s

Hi Rick, I want a little help on the same topic. How can I convert or
check the data entered in a Form is in Title case. That is the first
letter of every word is Capital and others are small. Thanks in advance.
 
R

Ron2005

1) On the first aspect of all being upper case, you could also simply
add an afterupdate event to say
me.fieldname = Ucase(me.fieldname)
Only done once then - less computer use.

2) On the second aspect. And then what are you going to do?
You could simply run a query that forces all of them to be
formated correctly (and do similar in the after update event for when
it is being entered.
me.fieldname = Ucase(left(me.fieldname,1)) &
Lcase(right(me.fieldname,(len(me.fieldname)-1)))
 
G

Guest

Rick,

Thanks for the message below. I get an "Access can't find the macro"
message on the KeyPress code in my Author form. (I'm using Access 2002.)
Any idea why?
 

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