Query using IIF statement based on Check Boxes

G

Guest

I entered the following into my query:
Ready to Start: IIf([Need_Print]=[Have_Print] & [Need_Data]=[Have_Data] &
[Need_Parts]=[Have_Parts] & [Need_Fixture]=[Have_Fixture],"Ready","Not Ready")

All the "Needs" and "Have" are check boxes, the query returns the "Ready"
value but if the boxes don't equal I get "#Error". I also did the statement:
Ready to Start: IIf([Need_Print]=[Have_Print] & [Need_Data]=[Have_Data] &
[Need_Parts]=[Have_Parts] &
[Need_Fixture]=[Have_Fixture],"Ready",IIf([Need_Print]=[Have_Print] &
[Need_Data]=[Have_Data] & [Need_Parts]=[Have_Parts] &
[Need_Fixture]=[Have_Fixture],"Not Ready")) with the same results.

Am I missing something?

Any help is much appreciated!
 
F

fredg

I entered the following into my query:
Ready to Start: IIf([Need_Print]=[Have_Print] & [Need_Data]=[Have_Data] &
[Need_Parts]=[Have_Parts] & [Need_Fixture]=[Have_Fixture],"Ready","Not Ready")

All the "Needs" and "Have" are check boxes, the query returns the "Ready"
value but if the boxes don't equal I get "#Error". I also did the statement:
Ready to Start: IIf([Need_Print]=[Have_Print] & [Need_Data]=[Have_Data] &
[Need_Parts]=[Have_Parts] &
[Need_Fixture]=[Have_Fixture],"Ready",IIf([Need_Print]=[Have_Print] &
[Need_Data]=[Have_Data] & [Need_Parts]=[Have_Parts] &
[Need_Fixture]=[Have_Fixture],"Not Ready")) with the same results.

Am I missing something?

Any help is much appreciated!

You are confusing the the Ampersand "&" (which is used in
concatenation), with the Operator word "AND".
I also placed parenthesis around each individual comparison.

Try:
Ready to Start: IIf(([Need_Print]=[Have_Print]) AND
([Need_Data]=[Have_Data]) AND
([Need_Parts]=[Have_Parts]) AND
([Need_Fixture]=[Have_Fixture]),"Ready","Not Ready")

If any set of comparisons is not true, "Not Ready" will display.
If all sets are true "Ready" will display.
 
G

Guest

Great! That worked! Thanks I knew I was overlooking something.

fredg said:
I entered the following into my query:
Ready to Start: IIf([Need_Print]=[Have_Print] & [Need_Data]=[Have_Data] &
[Need_Parts]=[Have_Parts] & [Need_Fixture]=[Have_Fixture],"Ready","Not Ready")

All the "Needs" and "Have" are check boxes, the query returns the "Ready"
value but if the boxes don't equal I get "#Error". I also did the statement:
Ready to Start: IIf([Need_Print]=[Have_Print] & [Need_Data]=[Have_Data] &
[Need_Parts]=[Have_Parts] &
[Need_Fixture]=[Have_Fixture],"Ready",IIf([Need_Print]=[Have_Print] &
[Need_Data]=[Have_Data] & [Need_Parts]=[Have_Parts] &
[Need_Fixture]=[Have_Fixture],"Not Ready")) with the same results.

Am I missing something?

Any help is much appreciated!

You are confusing the the Ampersand "&" (which is used in
concatenation), with the Operator word "AND".
I also placed parenthesis around each individual comparison.

Try:
Ready to Start: IIf(([Need_Print]=[Have_Print]) AND
([Need_Data]=[Have_Data]) AND
([Need_Parts]=[Have_Parts]) AND
([Need_Fixture]=[Have_Fixture]),"Ready","Not Ready")

If any set of comparisons is not true, "Not Ready" will display.
If all sets are true "Ready" will display.
 

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