文本框中的#error修复 [英] #error in text box fix

查看:74
本文介绍了文本框中的#error修复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一个db给我一个问题。我有一个表单,其中包含一个子表单,显示从组合框和选项按钮中过滤的数据。一切正常。


我现在在主表格底部的文本框显示某些数据(以子表格计算记录,平均出勤率,平均得分和最高支出费用)。这些都链接到子表单页脚中的文本框。


我已经计算了计数记录和平均出勤率,但剩下的两个框正在困扰我。得分的平均分数有效,但是当没有任何东西可以平均显示#error我想改变显示0.我已经尝试了Nz和Null值的所有版本都无济于事。


文本框中的当前代码如下:

Hi,

I have a db that is giving me a problem. I have a form which contains a sub-form that displays data that is filtered from combo boxes and option buttons. This all works fine.

I now text boxes at the bottom of my main form which display certain data (count records in sub form, Average attendance, Average mark scored, and highest expense paid). These are all linked to text boxes in the footer of the sub form.

I have got working the count records and average attendance however the remaining two boxes are stumping me. The average mark scored works however when there is nothing for it to avg it displays #error which I want to change to display 0. I have tried Nz and all versions on Null values to no avail.

The current code in the text box is as follows:

展开 | 选择 | Wrap | 行号

推荐答案

如果提供给函数的任何参数为null,则在使用像DLookup这样的域聚合函数时会返回#Error。由于要查找的表的名称和要返回的字段是您显示的语句中的字符串常量,因此将第三个参数(Where子句)作为潜在问题。


您将子窗体上的文本框的值提供给where子句([Text41])。当你说'什么时候没有什么可以平均''你的意思是子表单没有要显示的记录(即[Text41]为空)?


如果是这样,我建议使用IIF语句明确测试这个条件,用以下内容替换文本框的控件源属性:

#Error being returned when using domain aggregate functions like DLookup arise if any of the arguments supplied to the function are null. As the names of the table being looked up and the field to return are string constants in the statement you show, this leaves the third argument (the Where clause) as the potential problem.


You are supplying the value of a textbox on your subform to the where clause ([Text41]). When you say ''when there is nothing for it to avg'' do you mean that the subform has no records to show (i.e. [Text41] is null)?

If so, I''d suggest using an IIF statement to test for this condition explicitly, replacing the control source property of the textbox with:

展开 | 选择 | Wrap | 行号


您好,感谢您,但仍需要调整。我查看了代码并首先使用它,但现在不再适用于DLookup了。


我尝试了一些IIf代码的变体,包括更改null并将IIf代码放在一个新框中并分离DLookup和IIf代码,但这不起作用。我不知道为什么。有什么想法吗?
Hi, Thanks for this but still needs tweaking. I had a look at the code and firstly used it as t was but this now no longer applies the DLookup.

I have tried a few variations of the IIf code including changing null and also putting an IIf code in a new box and separating the DLookup and IIf code but this isnt working. Im not sure why. Any thoughts?


一般说明非特定的东西不起作用,让我们几乎无所事事。请发布您尝试的内容以及随后的结果。不工作可能意味着任何数量的结果,包括但不限于,没有返回值;返回的值不正确;空结果;错误结果。请花时间清楚地说明您的情况是什么,否则我们会尝试涵盖所有可能的情况,这会浪费很多时间。
General indications that something non-specific isn''t working leave us next to nothing to work with. Please post what you tried and exactly what result ensued. Not working could mean any number of results including, but not limited to, No values returned; Incorrect values returned; Null results; Error results. Please take the time to communicate clearly what your situation(s) is/are as otherwise we are trying to cover every possible scenario, which wastes a lot of time.


这篇关于文本框中的#error修复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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