Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIF statement with multiple conditions

Tags:

sql

ms-access

Consent:

IIf([consents].[decision]=1,"grant",
    IIf([consents].[allowbreaktheglass]=0,"deny""Default"),
    IIf([consents].[AllowBreakTheGlass]=1 AND [consents].[Decision]=0,"emergency only"))

IIF statement is returning an error:

The expression you entered has a function containing the wrong number of arguments

Criteria for consents are Grant, Deny and Emergency only.

like image 802
Ray Harlequin Avatar asked Apr 16 '26 02:04

Ray Harlequin


1 Answers

It's not 100% clear what you are trying to accomplish with your Nested IIF statement, however you are simply missing one failure argument, the following may be what you want:

Added 'Error?' for the last failure argument, as well as moved the 'Default' into the failure of the first clause.

Consent: 
    IIF([consents].[decision] = 1, 'grant',
        IIF([consents].[allowbreaktheglass] = 0, 'deny',
            IIF([consents].[AllowBreakTheGlass] = 1 AND [consents].[Decision] = 0,
                'emergency only', 'Error?')) 'Default')
like image 85
Jiggles32 Avatar answered Apr 17 '26 15:04

Jiggles32



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!