具有日期范围的嵌套IIF语句(和选择案例) [英] Nested IIF Statement (and Select Case) with Date Ranges

查看:82
本文介绍了具有日期范围的嵌套IIF语句(和选择案例)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好:

我在嵌套的If语句正常工作时遇到问题。我在MS Access 2002(OS Windows XP,2002年版)中工作。非工作代码将在Form(单个)上进行,如下所示:

Hello all:
I''m having trouble with a nested If Statement working properly. I''m working in MS Access 2002 (OS Windows XP, ver 2002). The non-working code is going on the Form (a Single) as follows:

展开 | 选择 | Wrap | 行号

推荐答案

嗨LBinGA -


只是快速浏览一下,我会请你试着在#中附上日期。迹象。例如,
Hi LBinGA -

Just from a quick look, I would ask you to try enclosing the dates in "#" signs. For instance,
展开 | 选择 | Wrap | 行号


OMG!我不敢相信就这么简单!我一直在努力工作这一天,尝试引号,2位数年份,4位数年份,并且在最后一小时站在我的角落里,没有一个能起作用,除了让我更头疼。 />

没有意识到我必须模仿查询。


谢谢,Pat!


现在,您是否会建议我继续使用IIf声明而不是Select Case?随着费率在未来几年的变化,我将需要添加日期范围....


再次感谢,


LB在GA中
OMG! I can''t believe it was that simple! I have been working on this ALL DAY, trying quotation marks, 2-digit years, 4-digit years, and standing on my head in the corner for the last hour, none of which worked save to give me a bigger headache.

Didn''t realize I would have to mimic a Query.

Thanks, Pat!

Now, would you recommend I continue to use the IIf Statement over the Select Case going forward? I will need to add date ranges, ad hoc, as rates change over the future years....

Thanks again,

LB in GA


大概你可以将你的日期范围与Rate一起存储在一个表中,然后通过查询或dlookup来检索这个比率。


虽然 ''用于表示字符串文字,#用于表示日期文字。 1/1/10基本上读为1除以1除以10.您可以强制访问使用cdate(1/1/2010)将字符串转换为日期,我认为在某些情况下如果访问给出一个字符串,它可能会尝试猜测转换本身。但是1/1/10只是一个匹配表达式,访问者不希望转换它。
Presumably you could have your date ranges stored in a table along with the Rate, and then retreive the rate by query or dlookup.

While " and '' are used to denote string literals, # are used to denote date literals. 1/1/10 is basicly read as 1 divided by 1 divided by 10. You can force access to convert a string to a date by using cdate("1/1/2010"), and I think in some cases if access is given a string, it might try to guess the conversion itself. But the 1/1/10 is just a match expression and access would have no wish to convert that.


这篇关于具有日期范围的嵌套IIF语句(和选择案例)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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