且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用OR运算符的IIF查询不起作用

更新时间:2023-11-13 15:59:46

不确定您是否需要太多likes,您在返回值中使用了or逻辑运算符

Not sure you need so many likes, you are using the or logical operator in the return value which doesn't make sense

IIF (condition, value-if-true, value-if-false)

所以..

Like IIF ([forms]![foo].[text1] = "1" OR [forms]![foo].[text2] = "1", 'bar', 'foobar')

如果满足任一条件,则IIF将返回"bar",否则将返回"foobar"

if either conditions are met IIF will return 'bar' else it will return 'foobar'

如果需要,可以嵌套它

Like IIF ([forms]![foo].[text1] = "1" OR [forms]![foo].[text2] = "1", 'bar', 
        IIF ([forms]![foo].[text1] = "2" AND [forms]![foo].[text2] = "2", 'foobar', null)
    )

如果满足任一条件,则IIF将返回'bar',否则我们检查text1 text2是否为"2",如果这样,则返回'foobar',否则我们返回null

if either conditions are met IIF will return 'bar' else we check to see if text1 and text2 are "2" if so return 'foobar' else we return null

希望这会有所帮助