Validation Rule assistance

R

Ray W.

I'm trying to enter a Validation rule that states the following: AgeofChild
=>3 and <=20... what is the appropriate way to enter this range for the
rule?

-Ray
 
R

Rick B

Where are you putting this? In a calcualted field that calculates the age?
If so, I would think your code would work.

You might also try...

Field Value Between 3 and 20


If in another field, then you'd need to reference the field where date is.
I think it would be something like...


Expression is [AgeUnboundFieldName].value between 3 and 20

or maybe

Expression is [AgeUnboundFieldName].value >= 3 and <= 20
 
R

Ray W.

Sorry, this would be at the Table level, in the design mode. User simply
enters child's age into field, value must be between 3 and 20 years of age.

Thanks

Rick B said:
Where are you putting this? In a calcualted field that calculates the age?
If so, I would think your code would work.

You might also try...

Field Value Between 3 and 20


If in another field, then you'd need to reference the field where date is.
I think it would be something like...


Expression is [AgeUnboundFieldName].value between 3 and 20

or maybe

Expression is [AgeUnboundFieldName].value >= 3 and <= 20

--
Rick B



Ray W. said:
I'm trying to enter a Validation rule that states the following: AgeofChild
=>3 and <=20... what is the appropriate way to enter this range for the
rule?

-Ray
 
R

Rick B

What happens after thier birthday? That is not a very good idea.
Typically, you would store the birthday and calculate their age against the
current date.

Conditional formatting is done in your forms or reports. You cannot display
data in the table using conditional formatting. Of course, once you design
the table, you should never open the table again anyway. Tables are storage
buckets, not user interfaces.

--
Rick B



Ray W. said:
Sorry, this would be at the Table level, in the design mode. User simply
enters child's age into field, value must be between 3 and 20 years of age.

Thanks

Rick B said:
Where are you putting this? In a calcualted field that calculates the age?
If so, I would think your code would work.

You might also try...

Field Value Between 3 and 20


If in another field, then you'd need to reference the field where date is.
I think it would be something like...


Expression is [AgeUnboundFieldName].value between 3 and 20

or maybe

Expression is [AgeUnboundFieldName].value >= 3 and <= 20

--
Rick B



Ray W. said:
I'm trying to enter a Validation rule that states the following: AgeofChild
=>3 and <=20... what is the appropriate way to enter this range for the
rule?

-Ray
 
R

Rick B

FYI. the preferred formula for calculating age is...

=DateDiff("yyyy",[Birthdate],Date())+(Format([Birthdate],"mmdd")>Format(Date
(),"mmdd"))


--
Rick B



Ray W. said:
Sorry, this would be at the Table level, in the design mode. User simply
enters child's age into field, value must be between 3 and 20 years of age.

Thanks

Rick B said:
Where are you putting this? In a calcualted field that calculates the age?
If so, I would think your code would work.

You might also try...

Field Value Between 3 and 20


If in another field, then you'd need to reference the field where date is.
I think it would be something like...


Expression is [AgeUnboundFieldName].value between 3 and 20

or maybe

Expression is [AgeUnboundFieldName].value >= 3 and <= 20

--
Rick B



Ray W. said:
I'm trying to enter a Validation rule that states the following: AgeofChild
=>3 and <=20... what is the appropriate way to enter this range for the
rule?

-Ray
 
T

tina

try
=3 and <=20

though Rick's suggestion of "Between 3 And 20" is easier, IMO. and i agree
with him that generally speaking it's not a good idea to store a person's
age as hard data, since it changes constantly - though sometimes there may
be a sound business reason for doing so.

hth
 
R

Ray W.

Whoa...

I think we're making this way to complicated...

This is a small database for survey results. One of the questions is, Age of
Child?. The data entry person simply needs to enter the age of the child -
between 3years and 20 years of age. I would like Access to ONLY accept
values (ages) between 3 and 20.

I figured that setting the Validation Rule with a value range between 3 and
20 would do what I need, to make it impossible for the user to enter any
other value outside of this range.


Ray W. said:
Sorry, this would be at the Table level, in the design mode. User simply
enters child's age into field, value must be between 3 and 20 years of age.

Thanks

Rick B said:
Where are you putting this? In a calcualted field that calculates the age?
If so, I would think your code would work.

You might also try...

Field Value Between 3 and 20


If in another field, then you'd need to reference the field where date is.
I think it would be something like...


Expression is [AgeUnboundFieldName].value between 3 and 20

or maybe

Expression is [AgeUnboundFieldName].value >= 3 and <= 20

--
Rick B



Ray W. said:
I'm trying to enter a Validation rule that states the following: AgeofChild
=>3 and <=20... what is the appropriate way to enter this range for the
rule?

-Ray
 
L

Lynn Trapp

Ray,
As has been suggested, simply set your validation rule to >= 3 AND <= 20.
Or, else, set it to Between 3 AND 20. That is, if you want the users to be
able to enter values of 3 and 20, respectively. If you want to exclude the
values of 3 and 20, then set it to either >3 AND 20, or Between 4 AND 19.
Also, be sure to add some appropriate Validation Text.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



Ray W. said:
Whoa...

I think we're making this way to complicated...

This is a small database for survey results. One of the questions is, Age
of
Child?. The data entry person simply needs to enter the age of the child -
between 3years and 20 years of age. I would like Access to ONLY accept
values (ages) between 3 and 20.

I figured that setting the Validation Rule with a value range between 3
and
20 would do what I need, to make it impossible for the user to enter any
other value outside of this range.


Ray W. said:
Sorry, this would be at the Table level, in the design mode. User simply
enters child's age into field, value must be between 3 and 20 years of age.

Thanks

Rick B said:
Where are you putting this? In a calcualted field that calculates the age?
If so, I would think your code would work.

You might also try...

Field Value Between 3 and 20


If in another field, then you'd need to reference the field where date is.
I think it would be something like...


Expression is [AgeUnboundFieldName].value between 3 and 20

or maybe

Expression is [AgeUnboundFieldName].value >= 3 and <= 20

--
Rick B



I'm trying to enter a Validation rule that states the following:
AgeofChild
=>3 and <=20... what is the appropriate way to enter this range for the
rule?

-Ray
 
R

Rick B

Sorry - somewhere I saw "conditional formatting". I must be going nuts!!!!



--
Rick B



Ray W. said:
Whoa...

I think we're making this way to complicated...

This is a small database for survey results. One of the questions is, Age of
Child?. The data entry person simply needs to enter the age of the child -
between 3years and 20 years of age. I would like Access to ONLY accept
values (ages) between 3 and 20.

I figured that setting the Validation Rule with a value range between 3 and
20 would do what I need, to make it impossible for the user to enter any
other value outside of this range.


Ray W. said:
Sorry, this would be at the Table level, in the design mode. User simply
enters child's age into field, value must be between 3 and 20 years of age.

Thanks

Rick B said:
Where are you putting this? In a calcualted field that calculates the age?
If so, I would think your code would work.

You might also try...

Field Value Between 3 and 20


If in another field, then you'd need to reference the field where date is.
I think it would be something like...


Expression is [AgeUnboundFieldName].value between 3 and 20

or maybe

Expression is [AgeUnboundFieldName].value >= 3 and <= 20

--
Rick B



I'm trying to enter a Validation rule that states the following:
AgeofChild
=>3 and <=20... what is the appropriate way to enter this range for the
rule?

-Ray
 
R

Ray W.

Yes, tried this but recieved the following error: This expression is typed
incorrectly, or it is too complex to be evaluated... Try simplifying the
expression by assigning parts of the expression to variables.

I've tried using - between...and... with the same message being generated,
this is why I'm coming to the group, I think its strange. Indexed is set to
Yes (Duplicates OK).
 
R

Ray W.

I refer to my previous note... I've tried these settings and am recieving
the error message stated in the previous note...

Guess I'll rebuild the field...


Lynn Trapp said:
Ray,
As has been suggested, simply set your validation rule to >= 3 AND <= 20.
Or, else, set it to Between 3 AND 20. That is, if you want the users to be
able to enter values of 3 and 20, respectively. If you want to exclude the
values of 3 and 20, then set it to either >3 AND 20, or Between 4 AND 19.
Also, be sure to add some appropriate Validation Text.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



Ray W. said:
Whoa...

I think we're making this way to complicated...

This is a small database for survey results. One of the questions is, Age
of
Child?. The data entry person simply needs to enter the age of the child -
between 3years and 20 years of age. I would like Access to ONLY accept
values (ages) between 3 and 20.

I figured that setting the Validation Rule with a value range between 3
and
20 would do what I need, to make it impossible for the user to enter any
other value outside of this range.


Ray W. said:
Sorry, this would be at the Table level, in the design mode. User simply
enters child's age into field, value must be between 3 and 20 years of age.

Thanks

"Rick B" <Anonymous> wrote in message
Where are you putting this? In a calcualted field that calculates the
age?
If so, I would think your code would work.

You might also try...

Field Value Between 3 and 20


If in another field, then you'd need to reference the field where
date
is.
I think it would be something like...


Expression is [AgeUnboundFieldName].value between 3 and 20

or maybe

Expression is [AgeUnboundFieldName].value >= 3 and <= 20

--
Rick B



I'm trying to enter a Validation rule that states the following:
AgeofChild
=>3 and <=20... what is the appropriate way to enter this range for the
rule?

-Ray
 
T

tina

are you sure you typed the expression *exactly* as i posted it? the only
difference between my post and your original one is

=>3 and <=20 (yours)
=3 and <=20 (mine)

also, is this the *only* validation criteria applied to this field in the
table? is there any *table level* validation criteria that refers to the age
field?

hth
 
V

Van T. Dinh

Use the *Field* Level validation instead of the Table validation.

Suggestions so far have been for Field Level validation since this only
involves 1 Field.

If you use Table level validation, you need to specify the Field name in
your expression, not just >=3 and <=20 since JET won't know which Field you
want to apply the rule.

HTH
Van T. Dinh
MVP Access)
 

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