帮助:Len功能使我感到困惑. [英] Help: Len function confusing me.
本文介绍了帮助:Len功能使我感到困惑.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在VBA中编写查询,并且我在使用Len函数时遇到问题:
代码:
I am writing a query in VBA and i am having issues with the Len function:
Code:
sql = "Select [" + fld.name + "] "
sql = sql + "from [" + tbl.name + "] "
sql = sql + "Where len([" + fld.name + "]) <= '10'"
如果我过滤的长度小于10,则该过程有效,查询将输出所有长度小于10的记录.但是,如果我使用"10"或更大的值,它将得到零记录?我尝试使用MS Access,它重复了该问题.
严重困惑...
If I filter for a length less than 10 the process works and the query outputs all records whose length is less than 10. However if I use ''10'' or greater it gives me zero records? I tried using MS Access and it repeated the problem.
Seriously confused...
推荐答案
Len应该返回一个数字值-因此,您不应与''10''
相对应,而应与10
相对应.
这行应该看起来像
sql = sql + "Where len([" + fld.name + "]) <= 10"
Len should be returning a numeric value - so you should not be comapring against''10''
but rather10
.
This line should look like
sql = sql + "Where len([" + fld.name + "]) <= 10"
这篇关于帮助:Len功能使我感到困惑.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文