The Use of IIF Statement with Multiple Conditions (1 Viewer)

adewale4favour

Registered User.
Local time
Yesterday, 19:06
Joined
Aug 9, 2019
Messages
55
Hi Guys,
I am presently working on an application and forms have been developed to handle data entry for the individual users. But there is a need to track a field, which should be disabled for users and get the information entered based on what the users populate in two related fields. For instance, If Field A is "Non Operational" and Field B is greater that 14, then field C must be "Inactive". I tried using nested If conditions as below.
iif([STATUS]="NON OPERATIONAL" AND [DueEstimate] > 14,[COUNT_FIELD] = "Inactive", "")

Please help evaluate this, perhaps there is something I am getting wrong, the above iif statement get me weird.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 19:06
Joined
Oct 29, 2018
Messages
21,473
Just take out the '[COUNT_FIELD]=' part.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 22:06
Joined
Feb 19, 2002
Messages
43,275
The expression would calculated in the query and be something like:

Select iif([STATUS]="NON OPERATIONAL" AND [DueEstimate] > 14, "Inactive", "Somethingelse") AS [COUNT_FIELD], fld2, fld3, etc
From ...
Where ...

It is poor practice to store values that can easily be calculated. Please do some reading on database normalization.
 

Users who are viewing this thread

Top Bottom