#Error in query

R

rookie

I created an IIf statement in my query and it somewhat works. When I ran it,
the "False" showed up as "False". However, the "True" showed up as "#Error".
Why is that?

Ab without Asp: IIf([Non-Asp Findings]="True" And [Normal
Swallow]="False","True","False")

Thanks!
Rookie
 
R

rookie

Hi Dale Fye,
The "Normal Swallow" field is a Yes/No. The "Non-asp findings" was created
in another query as an expression.

I do not see the check boxes for the Yes/No field because I imported the
data from an excel file into Access 2003. Afterwards, I converted the "Normal
Swallow" field into a "Yes/No".

Therefore, I'm lost why it doesn't work... could it be that it's not a true
yes/no field?

Dale Fye said:
Rookie,

Are the fields [Non-asp Findings] and [Normal Swallow] text fields or Yes/No?

If you want to store True/False type values in a table, I would recommend
the Yes/No datatype, which can be displayed as a checkbox. The advantage of
this method is that you don't actually have to test for "True" or "False",
you just create a logical expression.

Ab without ASP = [Non-Asp Findings] AND (NOT [Normal Swallow])

You might be running into a situation where one of the two fields contains a
NULL value, although the test for (NULL = "False") will evaluate to NULL, and
so will (NULL = "True"), so I'm not sure why this would cause an error.
----
HTH
Dale



rookie said:
I created an IIf statement in my query and it somewhat works. When I ran it,
the "False" showed up as "False". However, the "True" showed up as "#Error".
Why is that?

Ab without Asp: IIf([Non-Asp Findings]="True" And [Normal
Swallow]="False","True","False")

Thanks!
Rookie
 
D

Dale Fye

If it truely is a Yes/No field, then you cannot wrap the value in quotes,
you need to test against the boolean value. Try

Ab without Asp: IIf(([Non-Asp Findings]="True") And ([Normal Swallow]=
False),"True","False")

Dale

rookie said:
Hi Dale Fye,
The "Normal Swallow" field is a Yes/No. The "Non-asp findings" was created
in another query as an expression.

I do not see the check boxes for the Yes/No field because I imported the
data from an excel file into Access 2003. Afterwards, I converted the
"Normal
Swallow" field into a "Yes/No".

Therefore, I'm lost why it doesn't work... could it be that it's not a
true
yes/no field?

Dale Fye said:
Rookie,

Are the fields [Non-asp Findings] and [Normal Swallow] text fields or
Yes/No?

If you want to store True/False type values in a table, I would recommend
the Yes/No datatype, which can be displayed as a checkbox. The advantage
of
this method is that you don't actually have to test for "True" or
"False",
you just create a logical expression.

Ab without ASP = [Non-Asp Findings] AND (NOT [Normal Swallow])

You might be running into a situation where one of the two fields
contains a
NULL value, although the test for (NULL = "False") will evaluate to NULL,
and
so will (NULL = "True"), so I'm not sure why this would cause an error.
----
HTH
Dale



rookie said:
I created an IIf statement in my query and it somewhat works. When I
ran it,
the "False" showed up as "False". However, the "True" showed up as
"#Error".
Why is that?

Ab without Asp: IIf([Non-Asp Findings]="True" And [Normal
Swallow]="False","True","False")

Thanks!
Rookie
 
R

rookie

Hi Dale,
I tried your recommendation below and it didn't work. However, I did figure
it out by creating 2 separate IIf statement and it worked!

Thanks!
Rookie

Dale Fye said:
If it truely is a Yes/No field, then you cannot wrap the value in quotes,
you need to test against the boolean value. Try

Ab without Asp: IIf(([Non-Asp Findings]="True") And ([Normal Swallow]=
False),"True","False")

Dale

rookie said:
Hi Dale Fye,
The "Normal Swallow" field is a Yes/No. The "Non-asp findings" was created
in another query as an expression.

I do not see the check boxes for the Yes/No field because I imported the
data from an excel file into Access 2003. Afterwards, I converted the
"Normal
Swallow" field into a "Yes/No".

Therefore, I'm lost why it doesn't work... could it be that it's not a
true
yes/no field?

Dale Fye said:
Rookie,

Are the fields [Non-asp Findings] and [Normal Swallow] text fields or
Yes/No?

If you want to store True/False type values in a table, I would recommend
the Yes/No datatype, which can be displayed as a checkbox. The advantage
of
this method is that you don't actually have to test for "True" or
"False",
you just create a logical expression.

Ab without ASP = [Non-Asp Findings] AND (NOT [Normal Swallow])

You might be running into a situation where one of the two fields
contains a
NULL value, although the test for (NULL = "False") will evaluate to NULL,
and
so will (NULL = "True"), so I'm not sure why this would cause an error.
----
HTH
Dale



:

I created an IIf statement in my query and it somewhat works. When I
ran it,
the "False" showed up as "False". However, the "True" showed up as
"#Error".
Why is that?

Ab without Asp: IIf([Non-Asp Findings]="True" And [Normal
Swallow]="False","True","False")

Thanks!
Rookie


.
 
D

Dale Fye

Rookie,

What did your final code look like:

Dale

rookie said:
Hi Dale,
I tried your recommendation below and it didn't work. However, I did
figure
it out by creating 2 separate IIf statement and it worked!

Thanks!
Rookie

Dale Fye said:
If it truely is a Yes/No field, then you cannot wrap the value in quotes,
you need to test against the boolean value. Try

Ab without Asp: IIf(([Non-Asp Findings]="True") And ([Normal Swallow]=
False),"True","False")

Dale

rookie said:
Hi Dale Fye,
The "Normal Swallow" field is a Yes/No. The "Non-asp findings" was
created
in another query as an expression.

I do not see the check boxes for the Yes/No field because I imported
the
data from an excel file into Access 2003. Afterwards, I converted the
"Normal
Swallow" field into a "Yes/No".

Therefore, I'm lost why it doesn't work... could it be that it's not a
true
yes/no field?

:

Rookie,

Are the fields [Non-asp Findings] and [Normal Swallow] text fields or
Yes/No?

If you want to store True/False type values in a table, I would
recommend
the Yes/No datatype, which can be displayed as a checkbox. The
advantage
of
this method is that you don't actually have to test for "True" or
"False",
you just create a logical expression.

Ab without ASP = [Non-Asp Findings] AND (NOT [Normal Swallow])

You might be running into a situation where one of the two fields
contains a
NULL value, although the test for (NULL = "False") will evaluate to
NULL,
and
so will (NULL = "True"), so I'm not sure why this would cause an
error.
----
HTH
Dale



:

I created an IIf statement in my query and it somewhat works. When I
ran it,
the "False" showed up as "False". However, the "True" showed up as
"#Error".
Why is that?

Ab without Asp: IIf([Non-Asp Findings]="True" And [Normal
Swallow]="False","True","False")

Thanks!
Rookie


.
 

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