数据类型IIf函数不匹配 [英] Data Type Mismatch in an IIf function

查看:109
本文介绍了数据类型IIf函数不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,并提前感谢任何建议。


我可以独立运行以下IIf语句,但当我将它们组合在一起时,我得到一个数据类型不匹配 ;错误。以下是单独的陈述:

Hello, and thanks in advance for any advice.

I can run the following IIf statements without issue independently , but when I combine them together I get a "Data Type Mismatch" error. Here are the separate statements:

展开 | 选择 | Wrap | 行号

推荐答案

我有时会遇到类似问题,但它们是由于我在控制源字段中看不到的一些残留代码。确保你完全清理那个字段,然后重新开始,如果你有一个换行符,它可能会降压。


我无法尝试你的代码,但如果你的两个单独的功能正常工作,它看起来不错。


我建议从第一个开始,再次使用,然后添加第二个,但使变量保持常量值:
I have had similar problems sometimes, but they were due to some residual code I could not see in the Control Source field. Make sure you clean out that field completely, then start fresh, if you have a line break character in there it might buck.

I could not try your code but if your two seperate functions are working, it looks good.

I suggest start with the first one, make it work again, then add the second one but making the variables constant values:
展开 | 选择 | Wrap | 行号


Jon,有趣的问题,布局合理。我非常仔细地看了你的三个表达,我不得不说第三个失败的原因我没有看到任何分歧或原因。我建议每个比较表达式都包含在括号中(如下所示),但这在表达式2和表达式3之间很常见,所以我不希望它能解决你的问题。
Jon, interesting question and well laid out. I''ve looked at your three expressions very carefully and I have to say I don''t see any divergence or reason for the third one to fail. I would suggest that each of the comparison expressions is contained in parentheses (as below), but this is common between expressions two and three so I hold little hope it will resolve your issue.
展开 | 选择 | Wrap | 行号



Tot_Hours是两个日期的DateDiff(" h"),格式化作为一般数字

On_TG和To_TG都是两个不同日期的DatePart(h),格式化作为一般数字

Wgt_Time :1 /([Tot_Hours] + 1)
Tot_Hours is a DateDiff("h") on two dates, and formatted as a general number
On_TG and To_TG are both DatePart("h) of two different dates, and formatted as a general number
Wgt_Time: 1/([Tot_Hours]+1)



为了清楚起见,它们是否也作为一个数字存储,或​​者只是形成一个?

Just to be clear, are they also STORED as a number, or merely formated as one?


这篇关于数据类型IIf函数不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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