报告中的计算控制(文本框) [英] Calculated Control (Text Box) in a Report

查看:59
本文介绍了报告中的计算控制(文本框)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(请原谅我在描述中滥用任何条款,因为这是我的第一篇文章。)

我创建了一个文本框(在报告中),用于查找基于两个的百分比其他控件。除非其他控件的两个中都有空值,否则计算工作正常。我希望找到一种方法,只要出现这种情况,就可以返回0或一些文本(例如N / A)。目前,我收到#Num!错误。


我看过帖子,讨论如何通过消息框传递自定义错误消息,但我希望我的文章出现在文本框中。此外,我似乎无法找到#Num!的错误代码编号,因为我没有提供信息的Microsoft帮助加载项,我无法找到它在网上搜索(如果这样错误确实有一个数字。)


任何帮助将不胜感激。我的代码如下所示:

(Please forgive any misuse of terms in my description as this is my first post.)
I have created a text box (in a report) that is used to find a percentage based on two other controls. The calculation works fine unless there is a null value in both of the other controls. I would like to find a way to return either a 0 or bit of text (such as "N/A") whenever this situation arises. Currently, I receive the #Num! error.

I have seen posts which discuss how to pass a custom error message through a message box, but I would like mine to appear in the text box. Also, I cannot seem to find the error code number for #Num!, as I do not have the Microsoft Help Add-In avialable to me that provides the information, and I have not been able to find it searching the Web (if this error does indeed have a number).

Any assistance would be appreciated. My code appears below:

展开 | 选择 | Wrap | 行号

推荐答案

当您尝试时,此错误最常发生除以0之类的东西应该有效。

This error occurs most frequently when you try to divide by 0. Something like the following should work.

展开 | 选择 | Wrap | 行号


首先,感谢您对此的帮助。我尝试了你的建议,但我现在收到一个输入参数值。请求IIF声明。我试过改变争论,但无济于事。


另外,我很好奇为什么Nz语句被从分母中取出,因为SubReport1也可能为空,从而导致错误。我跟着这个逻辑有点麻烦,但是自由地承认我不是那个部门的秘诀。


再次感谢。


这是我现在出现的代码:

First, thank you for your help with this. I tried your suggestion, but I now receive an "Enter Parameter Value" request for the IIF statement. I''ve tried changing the arguments around, but to no avail.

Also, I''m curious as to why the Nz Statements were taken out of the denominator given that SubReport1 could also be null, causing an error. I''m having a little trouble following the logic, but freely admit that I''m no wiz in that department.

Thanks again.

Here''s my code as it appears now:

展开 | 选择 | Wrap | 行号



首先,感谢您对此的帮助。我尝试了你的建议,但我现在收到一个输入参数值。请求IIF声明。我试过改变争论,但无济于事。


另外,我很好奇为什么Nz语句被从分母中取出,因为SubReport1也可能为空,从而导致错误。我在遵循这个逻辑时遇到了一些麻烦,但是我自由地承认我不是那个部门的秘密。
First, thank you for your help with this. I tried your suggestion, but I now receive an "Enter Parameter Value" request for the IIF statement. I''ve tried changing the arguments around, but to no avail.

Also, I''m curious as to why the Nz Statements were taken out of the denominator given that SubReport1 could also be null, causing an error. I''m having a little trouble following the logic, but freely admit that I''m no wiz in that department.



我已经把它们放回SubReport1了。不知道为什么你要从subreport1添加Jan字段,但也把它包含在IIf的虚假声明中。


试试这个......

I''ve put them back for SubReport1. Not sure why you''re adding Jan field from subreport1 but have also included it in the false statement of the IIf.

Try this ...

展开 | 选择 | Wrap | 行号


这篇关于报告中的计算控制(文本框)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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