By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,098 Members | 1,255 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,098 IT Pros & Developers. It's quick & easy.

validation rule for alphabets only

P: n/a
Ben
Hi all,

In my STUDENT table, I have a field called STUDENT_NAME. I want the
data in this field to be only alphabets with allowance for ' and -
,but nothing else- no digits, no other special characters. The total
characters allowed are 50.

For example, these are allowed:
John O'Brian
Ken Keefe-Knowles Oliver
Jon Patrick

I tried few different ways but couldn't get the right result. Can
someone tell me how to do this?

Thanx
Ben
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
First of all there are 54 total characters, not 50. 26 upper case, 26, lower
case and 1 each for apostrophe and dash.

Use the Asc Function to check the Ascii value of the entries. Uppercase is 65 to
90, lowercase is 97 to 122, the apostrophe is 39 and the dash is 45.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Ben" <cr*********@yahoo.com> wrote in message
news:d9**************************@posting.google.c om...
Hi all,

In my STUDENT table, I have a field called STUDENT_NAME. I want the
data in this field to be only alphabets with allowance for ' and -
,but nothing else- no digits, no other special characters. The total
characters allowed are 50.

For example, these are allowed:
John O'Brian
Ken Keefe-Knowles Oliver
Jon Patrick

I tried few different ways but couldn't get the right result. Can
someone tell me how to do this?

Thanx
Ben

Nov 12 '05 #2

P: n/a
PC Datasheet,
Almost. Code will be more stable if you don't bother with what you want and
only look at the numeric values of what you do want. BTW--input masks in
forms handle this rather nicely.

"PC Datasheet" <sp**@nospam.spam> wrote in message
news:KJ*******************@newsread1.news.atl.eart hlink.net...
First of all there are 54 total characters, not 50. 26 upper case, 26, lower case and 1 each for apostrophe and dash.

Use the Asc Function to check the Ascii value of the entries. Uppercase is 65 to 90, lowercase is 97 to 122, the apostrophe is 39 and the dash is 45.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Ben" <cr*********@yahoo.com> wrote in message
news:d9**************************@posting.google.c om...
Hi all,

In my STUDENT table, I have a field called STUDENT_NAME. I want the
data in this field to be only alphabets with allowance for ' and -
,but nothing else- no digits, no other special characters. The total
characters allowed are 50.

For example, these are allowed:
John O'Brian
Ken Keefe-Knowles Oliver
Jon Patrick

I tried few different ways but couldn't get the right result. Can
someone tell me how to do this?

Thanx
Ben


Nov 12 '05 #3

P: n/a
Alan,

Agreed and that's what I said. The poster needs to check for upper and lower
case, the apostrophe and the dash.

Steve
PC Datasheet

"Alan Webb" <kn*****@hotmail.com> wrote in message
news:lQ***************@news.uswest.net...
PC Datasheet,
Almost. Code will be more stable if you don't bother with what you want and
only look at the numeric values of what you do want. BTW--input masks in
forms handle this rather nicely.

"PC Datasheet" <sp**@nospam.spam> wrote in message
news:KJ*******************@newsread1.news.atl.eart hlink.net...
First of all there are 54 total characters, not 50. 26 upper case, 26,

lower
case and 1 each for apostrophe and dash.

Use the Asc Function to check the Ascii value of the entries. Uppercase is

65 to
90, lowercase is 97 to 122, the apostrophe is 39 and the dash is 45.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Ben" <cr*********@yahoo.com> wrote in message
news:d9**************************@posting.google.c om...
Hi all,

In my STUDENT table, I have a field called STUDENT_NAME. I want the
data in this field to be only alphabets with allowance for ' and -
,but nothing else- no digits, no other special characters. The total
characters allowed are 50.

For example, these are allowed:
John O'Brian
Ken Keefe-Knowles Oliver
Jon Patrick

I tried few different ways but couldn't get the right result. Can
someone tell me how to do this?

Thanx
Ben



Nov 12 '05 #4

P: n/a
PC Datasheet,
Yup. In the past what I have done is write a function that acts as a filter
and only returns the characters I am interested in. What I am not clear on
from the original post is whether the code is a validation routine on a
form--in which case an input mask would do the trick--or as part of a batch
process where the validation has to happen without human intervention. If
it is the former, then input masks don't require special code, just a
property setting on the control of the form being designed. If it is the
latter, your solution would work.

"PC Datasheet" <sp**@nospam.spam> wrote in message
news:lm*******************@newsread1.news.atl.eart hlink.net...
Alan,

Agreed and that's what I said. The poster needs to check for upper and lower case, the apostrophe and the dash.

Steve
PC Datasheet

"Alan Webb" <kn*****@hotmail.com> wrote in message
news:lQ***************@news.uswest.net...
PC Datasheet,
Almost. Code will be more stable if you don't bother with what you want and only look at the numeric values of what you do want. BTW--input masks in forms handle this rather nicely.

"PC Datasheet" <sp**@nospam.spam> wrote in message
news:KJ*******************@newsread1.news.atl.eart hlink.net...
First of all there are 54 total characters, not 50. 26 upper case, 26,

lower
case and 1 each for apostrophe and dash.

Use the Asc Function to check the Ascii value of the entries.
Uppercase is 65 to
90, lowercase is 97 to 122, the apostrophe is 39 and the dash is 45.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Ben" <cr*********@yahoo.com> wrote in message
news:d9**************************@posting.google.c om...
> Hi all,
>
> In my STUDENT table, I have a field called STUDENT_NAME. I want the
> data in this field to be only alphabets with allowance for ' and -
> ,but nothing else- no digits, no other special characters. The total
> characters allowed are 50.
>
> For example, these are allowed:
> John O'Brian
> Ken Keefe-Knowles Oliver
> Jon Patrick
>
> I tried few different ways but couldn't get the right result. Can
> someone tell me how to do this?
>
> Thanx
> Ben



Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.