My IIF is superlong...is my syntax even correct?

t3nchi

Registered User.
Local time
Today, 08:55
Joined
Sep 28, 2005
Messages
79
This is what I'm trying to fit into the control box. Maybe there is a much better way to do it so suggestions are very welcome. I don't know if I can even use "!" in the IIF statement. And I think it's too long, so it's invalid.

What I'm trying to do is to check if all those fields are passing (or NOT failing). Then insert "Yes" or "No" into a textbox.

----------------------------------------------------------------
Code
----------------------------------------------------------------

IIF(blackStartPlans!=”fail” and operatorTraining!=”fail” and telemetryAvailable!=”fail” and backupControlCenter!=”fail” and vegetationManagement!=”fail” and capacityEmergencies!=”fail” and cat_A_contingency!=”fail” and cat_B_contingency!=”fail” and cat_C_contingency!=”fail” and cat_D_contingency!=”fail” and electricityFacRating!=”fail” and relayMaintenance!=”fail” and UFLS!=”fail” and UVLS!=”fail” and Other!=”fail”, “Yes”, “No”)
 
The VBA != (Not equal) is "<>". I don't think you've exceeded the limit to a ControlSource entry.
 
But is the rest correct? Because I'm getting one of those Enter Parameter Value boxes with "fail" written on it. Then another one. Then one that says "Yes" and one that says "No"...no idea why. I rechecked spelling and it seems fine. any idea?
 
I don't know what character you are using for the double quote delimiter but it needs to be Chr(34).
 
I'd like to restate my problem.

Let's say I have 3 textboxes (txtA,txtB,txtC). Here are their values.

txtA = Fail
txtB = Fail
txtC = Fail

I want to check to see txtA,B,and C are all "Fail". Then I want to assign a value called "All Fail" into a separate unbound textbox if they are all "Fail". Else, just assign "Some pass".

how would you all use IIF to solve this?
 
The other TextBox ControlSource would be:
=IIF((Me.txtA = "Fail") AND (Me.txtB = "Fail") AND (Me.txtC = "Fail"),"All Fail","Some Pass")
 

Users who are viewing this thread

Back
Top Bottom