473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

validation rule for alphabets only

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
4 7315
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Doslil | last post by:
I am trying to validate the fields in my database.I have already validated the fields to check for not null.Here is what I have written for Numeric and text field. Private Function EENUM() On...
2
by: Joey P | last post by:
Hi all, I am doing a project for university whereby i have to implement a simple database related to a frozen foods company. I am having some trouble though creating a validation rule for one...
7
by: Mathew Hill | last post by:
I am a beginner to the more technical aspects of Microsoft Access (2000) and was wondering if any one can help? I have a field in a table called: ADMIN NUMBER This field should have 4...
10
by: gweasel | last post by:
What is the best way to apply a Validation Rule - or rather, where is the best place to put it? Is there an advantage to putting it on the field in the table vs setting the validation rule on the...
1
by: Ashfaque Sayani | last post by:
i want to enforce that my password should have a combination of alphabets ,digits and one special character. if all three are present then only it shuld be valid. if a user enters only digits as...
17
nitindel
by: nitindel | last post by:
Hi All, I have a text box and want to validate it like this: I want to enter Numerics or alphanumerics in the text box but not Alphabets alone.If Alphabets alone entered then...
7
by: sharsy | last post by:
Hi guys, I would like to setup a validation rule for a database in microsoft access that restricts data entry so that a certain field can only be filled in if another field has a specific answer...
1
by: MLH | last post by:
Anyone remember if A97 append query failure would ever report data breaking validation rule when such was not the case. I have an old SQL statement - several years old now. I've encountered a case...
18
by: ChipR | last post by:
I have a text box with a validation rule and validation text. When entering a new record, if I put in invalid text, the validation text is displayed in a message box, but after clicking OK, another...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.