vba IsNothing 的反义词是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7757233/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
what is the opposite of IsNothing?
提问by giles
I want to say If the field "Resource" holds a value" ... then
basically the opposite of
我想说的If the field "Resource" holds a value" ... then
基本上是相反的
IIF(IsNothing(Fields!Resource.Value)
IIF(IsNothing(Fields!Resource.Value)
can you please help
你能帮忙吗
回答by Widor
回答by aevanko
A very efficient way to check a value exists is to check it's length:
检查值是否存在的一种非常有效的方法是检查它的长度:
If Len(Fields!Resource.Value) <> 0
如果 Len(Fields!Resource.Value) <> 0
回答by Patrick Honorez
IsNothing() does NOT exist in VBA. To check if a field or a variant contains something, you should useIf myField Is NUll then
IsNothing() 在 VBA 中不存在。要检查字段或变体是否包含某些内容,您应该使用If myField Is NUll then
To check for unassigned objects, use
要检查未分配的对象,请使用
If myObject Is Nothing Then