访问 - 计数(iif基于2个字段中的值? [英] Access - count(iif based on values in 2 fields?

查看:87
本文介绍了访问 - 计数(iif基于2个字段中的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用报告字段时遇到问题。


只需将表中的记录统计在两个位置:

1. Field1 - 日期小于2013年1月1日;并且

2. Field2 - 为空


在表格中,字段1和2是日期字段,包含日期或空白。


我尝试过以下方法:


表达式:计数(IIf(([tbl]。[field1]<#1/01 / 2013#)和([tbl]。[field2]是空的),1,0))


但......不工作。任何帮助将不胜感激!

I’m having trouble with a report field.

Need it to count records in a table only where BOTH:
1. Field1 – date is less than 1/1/2013; and
2. Field2 – is null

In the table, Fields 1 and 2 are date fields and either contain a date, or are left empty.

I’ve tried the following:

Expression: Count(IIf(([tbl].[field1]<#1/01/2013#) And ([tbl].[field2] Is Null),1,0))

but... not working. Any help would be appreciated!

推荐答案

您的表达式显示<#1/01/2013#但您对问题的描述是IS 1/1/2013。代码是错误的还是描述?


Jim
Your expression says <#1/01/2013# but your description of the problem says IS 1/1/2013. Is the code wrong or the description?

Jim


描述错误 - 现在将编辑
The description is wrong - will edit now


伯爵并不在乎它的重要性。将您的标准放在where子句中,而不是使用iif。
Count doesn''t care what it counts. Put your criteria in the where clause instead of using iif.


这篇关于访问 - 计数(iif基于2个字段中的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆