IIF statements

G

Guest

Hi hope someone can help this novice...
i have a query with the following info
FIELD - APPROVED (this field shows a 1 or 0 when the query is run)
TABLE - T_ALL ORDERS (the table where the data is pulled from)

i need an IIf statement to say IIf = to 1 then say YES if 0 then NO

i have this so far but it comes up with error, data type mismatch
IIF([APPROVED] = "1", "yes","no"

any help would be great
Thankyou
Sean
 
G

Guest

Try this --
IIF([APPROVED] = 1, "Yes","No")

Or maybe it is a minus one instead of one.
IIF([APPROVED] = -1, "Yes","No")
 
N

Neil Sunderland

SeanE said:
i need an IIf statement to say IIf = to 1 then say YES if 0 then NO

i have this so far but it comes up with error, data type mismatch
IIF([APPROVED] = "1", "yes","no"

Delete the quotes around the number (and add a closing bracket!):
IIF([APPROVED] = 1, "yes","no")
 
G

Guest

Tried this but still no joy, any other ideas
Thanks
Sean

KARL DEWEY said:
Try this --
IIF([APPROVED] = 1, "Yes","No")

Or maybe it is a minus one instead of one.
IIF([APPROVED] = -1, "Yes","No")

SeanE said:
Hi hope someone can help this novice...
i have a query with the following info
FIELD - APPROVED (this field shows a 1 or 0 when the query is run)
TABLE - T_ALL ORDERS (the table where the data is pulled from)

i need an IIf statement to say IIf = to 1 then say YES if 0 then NO

i have this so far but it comes up with error, data type mismatch
IIF([APPROVED] = "1", "yes","no"

any help would be great
Thankyou
Sean
 
G

Guest

Is the field in your table where the 1's and 0's are called "Approved", or is
that the name given to the answer down in the Query by Example grid? The
reason I ask is that the two previous answers appear correct so my guess is
that we are not quite understanding the question. To clarify, what is the
name of the field in the table that has the zeros and ones?

Jeff
 
G

Guest

Another thing to check - what is the datatype of the field?
Is it a logical field - Yes/No?
Is it a numberical field?
Is it a text field?

Jeff said:
Is the field in your table where the 1's and 0's are called "Approved", or is
that the name given to the answer down in the Query by Example grid? The
reason I ask is that the two previous answers appear correct so my guess is
that we are not quite understanding the question. To clarify, what is the
name of the field in the table that has the zeros and ones?

Jeff

SeanE said:
Hi hope someone can help this novice...
i have a query with the following info
FIELD - APPROVED (this field shows a 1 or 0 when the query is run)
TABLE - T_ALL ORDERS (the table where the data is pulled from)

i need an IIf statement to say IIf = to 1 then say YES if 0 then NO

i have this so far but it comes up with error, data type mismatch
IIF([APPROVED] = "1", "yes","no"

any help would be great
Thankyou
Sean
 
G

Guest

Hi Jeff,

field name is = Approved,
Table = T_all orders

when i run the query it produces 1 and 0 and i need the 1 to say "yes" and
the 0 to say "No", when i put in the criteria field IIF([APPROVED] = "1",
"yes","no" it just keep coming up data type mismatch, i've checked the make
sure the datatype of the field is a number field.
hope this helps
thanks for your time
Sean

Jeff said:
Is the field in your table where the 1's and 0's are called "Approved", or is
that the name given to the answer down in the Query by Example grid? The
reason I ask is that the two previous answers appear correct so my guess is
that we are not quite understanding the question. To clarify, what is the
name of the field in the table that has the zeros and ones?

Jeff

SeanE said:
Hi hope someone can help this novice...
i have a query with the following info
FIELD - APPROVED (this field shows a 1 or 0 when the query is run)
TABLE - T_ALL ORDERS (the table where the data is pulled from)

i need an IIf statement to say IIf = to 1 then say YES if 0 then NO

i have this so far but it comes up with error, data type mismatch
IIF([APPROVED] = "1", "yes","no"

any help would be great
Thankyou
Sean
 

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