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

Alphabetical Validation

Status
Not open for further replies.

LDG1234

Programmer
Jun 26, 2001
120
0
0
GB
Hi guys

Can anyone help me with a robust bit of validation.
I need to ensure that users only enter alphabetical characters. I have used the IsNumeric function to eliminate all numbers, but they can still enter abc456defg.

Can anyone assist????

Thanks in advance.. Lloyd Gozzett
Process Developer
 
Look at an Input Mask. You can easily set up a mask to accept only letters. A mask of 'LLLL' requires entry of exactly 4 letters. 'L???' requires at least one and up to 4 letters. The upside is no need to put anything into a LostFocus or AfterUpdate event.
 
Okay, I can see how this works.
I just need to adapt the msg that comes up to explain to the user what exactly they need to input into the cell.
Any ideas? Lloyd Gozzett
Process Developer
 
on the On Enter you should put

MsgBox "Please input in the format 123456789", vbOKOnly, "Use the following format"

and then the input mask will eather be
000000000 - if you want the user to HAVE to input the numbers, for example 123456789
999999999 - If you want the user to have the option to enter the numbers, for example 10
 
Thanks Slyv

I don't want the message to be displayed everytime that a user enters the cell as this will slow things down and would start to frustrate people. I just want to adapt the msg which is displayed when that entered does not match the input mask.

Any ideas? Lloyd Gozzett
Process Developer
 
You dont need the msgbox there, it is only there to inform the user, if you just have to have the input mask and it will not allow the user to input any letters.

so a input mask of 99999
will allow the user to ONLY enter up to five numbers. NO LETTERS.

If you want the user to enter letters use a L or ?
 
Sylv

Not sure you understand my query fully.
If I have the input mask on and they dont enter it correctly you get a Access Msg Box saying:

Incorrect Input Mask Format "LLLLLL" etc etc.

This means absolutley nothing to the users so I would like to replace this with a specific message telling them precisely what is required. I only want this displayed if they breach the input mask and not every time they click into the cell...any ideas?? Lloyd Gozzett
Process Developer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top