查询空字段 [英] Query for empty fields

查看:92
本文介绍了查询空字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我必须在Access查询中获取一个值,该值取决于我是否有一个空字段,而我无法获得解决方案以便正确决定IF条款



当前不起作用的查询如下:

Hello,

I have to get a value in an Access query that depends on if I have one empty field, and I cannot get the solution in order to decide the "IF" clause correctly

The current query that does not work is as follows:

DelayDays: (if([RealDate]=0;[PlannedDate];[RealDate])-[CommitedDate])



日期是日期格式,减法有效好吧,但在某些情况下,我在数据库中将[RealDate]字段清空,然后我得到DelayDays为空字段的结果。



然后,我的问题是if子句总是执行为false。因此,当字段[RealDate]为空时,它无法进行计算并返回空字段(不是错误)。



我也尝试过其他选项Access接受if语句中的有效比较,例如


The dates are in date format, and the substraction works well, but in some cases I have the [RealDate] field empty in the database, and then I get as result for "DelayDays" an empty field.

Then, my problem is that the "if" clause is always executed as "false". Thus when the field[RealDate] is empty, it can not make the calculation and returns an empty field (not an error).

I have also tried with other options that the Access accept as valid comparisons within the "if" statement, like

[RealDate]<1
isempty([RealDate])

等,但我没有办法检测该字段是空的还是没有价值。



任何帮助都将受到高度赞赏。



提前谢谢,



David

etc, but I do not get a way of detecting when the field is empty or has no value.

Any help will be highly appreciated.

Thank you in advance,

David

推荐答案

假设空表示空,请查看 IsNull [< a href =http://www.techonthenet.com/access/functions/advanced/isnull.phptarget =_ blanktitle =新窗口> ^ ]功能:用它来替换值合理的默认值。

http://office.microsoft.com/en-gb/access-help/examples-of-expressions-that-c​​heck-for-null-values- HP001099035.aspx [ ^ ]
Assuming by "empty" you mean "null", look at the IsNull[^] function: use it to replace the values with "sensible" defaults.
http://office.microsoft.com/en-gb/access-help/examples-of-expressions-that-check-for-null-values-HP001099035.aspx[^]


这篇关于查询空字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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