Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 基于选项按钮的Microsoft Access查询_Sql_Ms Access - Fatal编程技术网

Sql 基于选项按钮的Microsoft Access查询

Sql 基于选项按钮的Microsoft Access查询,sql,ms-access,Sql,Ms Access,我正在Access中生成一个查询。如果选择了[Main]窗体上的选项按钮,则需要过滤[V2]字段之一。现在,我为字段输入了以下条件 Field: Expr3: [V2]>0 On Criteria: IIf([FORMS]![Main]![optV2]<0,True) 字段:Expr3:[V2]>0 关于标准:IIf([FORMS]![Main]![optV2]您需要去掉围绕标准的IIf函数。它需要如下所示: Criteria: [Forms]![Main]![

我正在Access中生成一个查询。如果选择了[Main]窗体上的选项按钮,则需要过滤[V2]字段之一。现在,我为字段输入了以下条件

Field:         Expr3: [V2]>0
On Criteria:   IIf([FORMS]![Main]![optV2]<0,True)
字段:Expr3:[V2]>0

关于标准:IIf([FORMS]![Main]![optV2]您需要去掉围绕标准的
IIf
函数。它需要如下所示:

Criteria: [Forms]![Main]![optV2] < 0
Criteria: [Forms]![Main]![optV2] = true
您的方法不起作用的原因是您没有在
iif
函数中指定如果条件的计算结果为false将返回什么值。严格来说,函数调用的正确形式应该是:

iif([Forms]![Main]![optV2] < 0, true, false)
iif([Forms]![Main]![optV2]<0,对,错)
但是,由于查询设计器条件输入字段已经评估了条件,因此根本不需要那里的
iif
函数