Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » Access

Validation Rules ?

 
Jump to:  
 
Carol Shu
PostPosted: Fri Sep 26, 2008 11:12 am    Post subject: Validation Rules ?
       
Hi, How to do this...
I have a table name [tblVehicle], and a field name [OdometerReading] data
type is TEXT, how to force it only allow enter 5 or 6 digit, some older
vehicle only have 5 digit odometer reading, newer car are most 6 digit.
and if the vehicle is 10 year old or older then enter "EXEMPT" in the field
[OdometerReading], i'm not sure to start with validation rules or how to do
this, please help, many thanks.
 

 
Allen Browne
PostPosted: Fri Sep 26, 2008 11:23 am    Post subject: Re: Validation Rules ?
       
Change it to a Number field.

That will be much easier than forcing users to enter a leading zero, and
guaranteeing that no non-numeric characters get into the field.

Use Null instead of Exempt. If you want to force users to enter something
for entries newer than 10 years old, you could put a validation rule on the
table (not field) of something like:
([EntryDate] < Date() - 3652) OR ([OdometerReading Is Not Null)

More about validation rules:
LINK

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - LINK
Reply to group, rather than allenbrowne at mvps dot org.

"Carol Shu" <CarolShu@discussions.microsoft.com> wrote in message
news:6EFC5FD3-6CC8-410A-87C5-702A1CBAC937@microsoft.com...
Quote:
Hi, How to do this...
I have a table name [tblVehicle], and a field name [OdometerReading] data
type is TEXT, how to force it only allow enter 5 or 6 digit, some older
vehicle only have 5 digit odometer reading, newer car are most 6 digit.
and if the vehicle is 10 year old or older then enter "EXEMPT" in the
field
[OdometerReading], i'm not sure to start with validation rules or how to
do
this, please help, many thanks.
 

 
Carol Shu
PostPosted: Fri Sep 26, 2008 11:40 am    Post subject: Re: Validation Rules ?
       
Thank you Allen.
I tried it, and work great, but one more problem here, how do you force it
allow user enter 5 or 6 digits only? like 12345 or 123456 ? right now you can
enter like 123456789 even more, please help thanks.

"Allen Browne" wrote:

Quote:
Change it to a Number field.

That will be much easier than forcing users to enter a leading zero, and
guaranteeing that no non-numeric characters get into the field.

Use Null instead of Exempt. If you want to force users to enter something
for entries newer than 10 years old, you could put a validation rule on the
table (not field) of something like:
([EntryDate] < Date() - 3652) OR ([OdometerReading Is Not Null)

More about validation rules:
LINK

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - LINK
Reply to group, rather than allenbrowne at mvps dot org.

"Carol Shu" <CarolShu@discussions.microsoft.com> wrote in message
news:6EFC5FD3-6CC8-410A-87C5-702A1CBAC937@microsoft.com...
Hi, How to do this...
I have a table name [tblVehicle], and a field name [OdometerReading] data
type is TEXT, how to force it only allow enter 5 or 6 digit, some older
vehicle only have 5 digit odometer reading, newer car are most 6 digit.
and if the vehicle is 10 year old or older then enter "EXEMPT" in the
field
[OdometerReading], i'm not sure to start with validation rules or how to
do
this, please help, many thanks.

 

 
Paul Shapiro
PostPosted: Fri Sep 26, 2008 11:50 am    Post subject: Re: Validation Rules ?
       
([EntryDate] < Date() - 3652) OR ([OdometerReading] Is Not Null And
[OdometerReading] Between 10000 and 999999)

But you probably need to allow numbers less than 10,000? Once it's a numeric
field, you can't require users to enter leading zeroes. So maybe what you
want is just:

([EntryDate] < Date() - 3652) OR ([OdometerReading] Is Not Null And
[OdometerReading] < 999999)


"Carol Shu" <CarolShu@discussions.microsoft.com> wrote in message
news:C07E21ED-62CD-4772-A04E-D2749A87D617@microsoft.com...
Quote:
Thank you Allen.
I tried it, and work great, but one more problem here, how do you force it
allow user enter 5 or 6 digits only? like 12345 or 123456 ? right now you
can
enter like 123456789 even more, please help thanks.

"Allen Browne" wrote:

Change it to a Number field.

That will be much easier than forcing users to enter a leading zero, and
guaranteeing that no non-numeric characters get into the field.

Use Null instead of Exempt. If you want to force users to enter something
for entries newer than 10 years old, you could put a validation rule on
the
table (not field) of something like:
([EntryDate] < Date() - 3652) OR ([OdometerReading Is Not Null)

More about validation rules:
LINK

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - LINK
Reply to group, rather than allenbrowne at mvps dot org.

"Carol Shu" <CarolShu@discussions.microsoft.com> wrote in message
news:6EFC5FD3-6CC8-410A-87C5-702A1CBAC937@microsoft.com...
Hi, How to do this...
I have a table name [tblVehicle], and a field name [OdometerReading]
data
type is TEXT, how to force it only allow enter 5 or 6 digit, some older
vehicle only have 5 digit odometer reading, newer car are most 6 digit.
and if the vehicle is 10 year old or older then enter "EXEMPT" in the
field
[OdometerReading], i'm not sure to start with validation rules or how
to
do
this, please help, many thanks.

 

 
Carol Shu
PostPosted: Fri Sep 26, 2008 12:03 pm    Post subject: Re: Validation Rules ?
       
Thank you Paul.
I tried both, it doesn't work. I enter like 333, it let me jump to the next
field, then i enter like 55533333, it did the same, any more suggestions,
thank you again. be sure about this, I put a validation rule on the table
(not field).

"Paul Shapiro" wrote:

Quote:
([EntryDate] < Date() - 3652) OR ([OdometerReading] Is Not Null And
[OdometerReading] Between 10000 and 999999)

But you probably need to allow numbers less than 10,000? Once it's a numeric
field, you can't require users to enter leading zeroes. So maybe what you
want is just:

([EntryDate] < Date() - 3652) OR ([OdometerReading] Is Not Null And
[OdometerReading] < 999999)


"Carol Shu" <CarolShu@discussions.microsoft.com> wrote in message
news:C07E21ED-62CD-4772-A04E-D2749A87D617@microsoft.com...
Thank you Allen.
I tried it, and work great, but one more problem here, how do you force it
allow user enter 5 or 6 digits only? like 12345 or 123456 ? right now you
can
enter like 123456789 even more, please help thanks.

"Allen Browne" wrote:

Change it to a Number field.

That will be much easier than forcing users to enter a leading zero, and
guaranteeing that no non-numeric characters get into the field.

Use Null instead of Exempt. If you want to force users to enter something
for entries newer than 10 years old, you could put a validation rule on
the
table (not field) of something like:
([EntryDate] < Date() - 3652) OR ([OdometerReading Is Not Null)

More about validation rules:
LINK

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - LINK
Reply to group, rather than allenbrowne at mvps dot org.

"Carol Shu" <CarolShu@discussions.microsoft.com> wrote in message
news:6EFC5FD3-6CC8-410A-87C5-702A1CBAC937@microsoft.com...
Hi, How to do this...
I have a table name [tblVehicle], and a field name [OdometerReading]
data
type is TEXT, how to force it only allow enter 5 or 6 digit, some older
vehicle only have 5 digit odometer reading, newer car are most 6 digit.
and if the vehicle is 10 year old or older then enter "EXEMPT" in the
field
[OdometerReading], i'm not sure to start with validation rules or how
to
do
this, please help, many thanks.



 

 
Allen Browne
PostPosted: Fri Sep 26, 2008 12:38 pm    Post subject: Re: Validation Rules ?
       
Carol, you have not applied Paul's suggestion correctly if it let you enter
333 (unless it was for a really old date.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - LINK
Reply to group, rather than allenbrowne at mvps dot org.

"Carol Shu" <CarolShu@discussions.microsoft.com> wrote in message
news:E9F196DE-76BF-4077-A0A6-25F907385BC4@microsoft.com...
Quote:
Thank you Paul.
I tried both, it doesn't work. I enter like 333, it let me jump to the
next
field, then i enter like 55533333, it did the same, any more suggestions,
thank you again. be sure about this, I put a validation rule on the table
(not field).

"Paul Shapiro" wrote:

([EntryDate] < Date() - 3652) OR ([OdometerReading] Is Not Null And
[OdometerReading] Between 10000 and 999999)

But you probably need to allow numbers less than 10,000? Once it's a
numeric
field, you can't require users to enter leading zeroes. So maybe what you
want is just:

([EntryDate] < Date() - 3652) OR ([OdometerReading] Is Not Null And
[OdometerReading] < 999999)
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

Do Samotności - Mickiewicz Adam konferencje i szkolenia usługi budowlane warszawa hotel panorama kreta Podczas Świąt - Lipska Ewa