IF Query critera <120 "true" >120 "false"

S

slagg7575

Hi all,

I have a query with fields that have numbers in them. I have a field
called 'Waist' that has a range of numbers. What I would like, is to
query the numbers >120 and have the same field report "TRUE" rather
than the number once there, and for values <120 the field would now say
"False". I know how to list the numbers < and > than 120, but what I
need is for TRUE or FALSE to either reside now in the field or a new
colum beside that field. I hope this makes sence. Can anybody help?

Thanks in advance,
 
J

Jeff L

Put this in a field in your query
iif([Waist] > 120, "True", "False")

You can still output the actual value for Waist if you want to.
 
S

slagg7575

Thank for the quick reply! I get a "Data type mismatch in criteria
expression"
I even tried changing the True to 1 and False to 0, and got the same
error message.
Any reason why?

Thanks,!
Jeff said:
Put this in a field in your query
iif([Waist] > 120, "True", "False")

You can still output the actual value for Waist if you want to.


Hi all,

I have a query with fields that have numbers in them. I have a field
called 'Waist' that has a range of numbers. What I would like, is to
query the numbers >120 and have the same field report "TRUE" rather
than the number once there, and for values <120 the field would now say
"False". I know how to list the numbers < and > than 120, but what I
need is for TRUE or FALSE to either reside now in the field or a new
colum beside that field. I hope this makes sence. Can anybody help?

Thanks in advance,
 
S

slagg7575

DOH!
I was entering it in Criteria! not a new field! Sorry my bad. One last
question though...
I have several fields to run the same type of equation where I will get
a TRUE or False answer. If I have 5 fields that were

WAIST, HIP, HEIGHT, BLUE, RED NEW FIELD (3true out of
the 5=TRUE)
true true false true false True

If i get ANY of the 3/5 fields being true, I need a new field called
"Tally" for instance, to read "True" otherwise I need it to read False.
So, if I get only 2 fields, out of the 5 with a true in them, I need
"Tally" to read FALSE. Something like True>3 ="True" True <3 ="False"
How is this done?

Thanks again!


Thank for the quick reply! I get a "Data type mismatch in criteria
expression"
I even tried changing the True to 1 and False to 0, and got the same
error message.
Any reason why?

Thanks,!
Jeff said:
Put this in a field in your query
iif([Waist] > 120, "True", "False")

You can still output the actual value for Waist if you want to.


Hi all,

I have a query with fields that have numbers in them. I have a field
called 'Waist' that has a range of numbers. What I would like, is to
query the numbers >120 and have the same field report "TRUE" rather
than the number once there, and for values <120 the field would now say
"False". I know how to list the numbers < and > than 120, but what I
need is for TRUE or FALSE to either reside now in the field or a new
colum beside that field. I hope this makes sence. Can anybody help?

Thanks in advance,
 
S

slagg7575

DOH!
I was entering it in Criteria! not a new field! Sorry my bad. One last
question though...
I have several fields to run the same type of equation where I will get
a TRUE or False answer. If I have 5 fields that were

WAIST, HIP, HEIGHT, BLUE, RED NEW FIELD (3true out of
the 5=TRUE)
true true false true false True

If i get ANY of the 3/5 fields being true, I need a new field called
"Tally" for instance, to read "True" otherwise I need it to read False.
So, if I get only 2 fields, out of the 5 with a true in them, I need
"Tally" to read FALSE. Something like True>3 ="True" True <3 ="False"
How is this done?

Thanks again!


Thank for the quick reply! I get a "Data type mismatch in criteria
expression"
I even tried changing the True to 1 and False to 0, and got the same
error message.
Any reason why?

Thanks,!
Jeff said:
Put this in a field in your query
iif([Waist] > 120, "True", "False")

You can still output the actual value for Waist if you want to.


Hi all,

I have a query with fields that have numbers in them. I have a field
called 'Waist' that has a range of numbers. What I would like, is to
query the numbers >120 and have the same field report "TRUE" rather
than the number once there, and for values <120 the field would now say
"False". I know how to list the numbers < and > than 120, but what I
need is for TRUE or FALSE to either reside now in the field or a new
colum beside that field. I hope this makes sence. Can anybody help?

Thanks in advance,
 
D

David Cox

I note that you have >120 and <120, what about =120?


DOH!
I was entering it in Criteria! not a new field! Sorry my bad. One last
question though...
I have several fields to run the same type of equation where I will get
a TRUE or False answer. If I have 5 fields that were

WAIST, HIP, HEIGHT, BLUE, RED NEW FIELD (3true out of
the 5=TRUE)
true true false true false True

If i get ANY of the 3/5 fields being true, I need a new field called
"Tally" for instance, to read "True" otherwise I need it to read False.
So, if I get only 2 fields, out of the 5 with a true in them, I need
"Tally" to read FALSE. Something like True>3 ="True" True <3 ="False"
How is this done?

Thanks again!


Thank for the quick reply! I get a "Data type mismatch in criteria
expression"
I even tried changing the True to 1 and False to 0, and got the same
error message.
Any reason why?

Thanks,!
Jeff said:
Put this in a field in your query
iif([Waist] > 120, "True", "False")

You can still output the actual value for Waist if you want to.


(e-mail address removed) wrote:
Hi all,

I have a query with fields that have numbers in them. I have a field
called 'Waist' that has a range of numbers. What I would like, is to
query the numbers >120 and have the same field report "TRUE" rather
than the number once there, and for values <120 the field would now
say
"False". I know how to list the numbers < and > than 120, but what I
need is for TRUE or FALSE to either reside now in the field or a new
colum beside that field. I hope this makes sence. Can anybody help?

Thanks in advance,
 
J

Jeff L

Ok. For your tally field, it would probably be better to use 1 for
True and 0 for False in your other fields instead of "True" and
"False". That way you can add the numbers together:
iif(([Field1] + [Field2] + [Field3] + [Field4] + [Field5]) >= 3,
"True", "False)

Hope that helps!




DOH!
I was entering it in Criteria! not a new field! Sorry my bad. One last
question though...
I have several fields to run the same type of equation where I will get
a TRUE or False answer. If I have 5 fields that were

WAIST, HIP, HEIGHT, BLUE, RED NEW FIELD (3true out of
the 5=TRUE)
true true false true false True

If i get ANY of the 3/5 fields being true, I need a new field called
"Tally" for instance, to read "True" otherwise I need it to read False.
So, if I get only 2 fields, out of the 5 with a true in them, I need
"Tally" to read FALSE. Something like True>3 ="True" True <3 ="False"
How is this done?

Thanks again!


Thank for the quick reply! I get a "Data type mismatch in criteria
expression"
I even tried changing the True to 1 and False to 0, and got the same
error message.
Any reason why?

Thanks,!
Jeff said:
Put this in a field in your query
iif([Waist] > 120, "True", "False")

You can still output the actual value for Waist if you want to.


(e-mail address removed) wrote:
Hi all,

I have a query with fields that have numbers in them. I have a field
called 'Waist' that has a range of numbers. What I would like, is to
query the numbers >120 and have the same field report "TRUE" rather
than the number once there, and for values <120 the field would now say
"False". I know how to list the numbers < and > than 120, but what I
need is for TRUE or FALSE to either reside now in the field or a new
colum beside that field. I hope this makes sence. Can anybody help?

Thanks in advance,
 

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