Access 2007 vba 空
我的程序不会处理以下语句:
Dim valid as Boolean
If MyComboBox.Value Is Not Null Then valid = true
为什么不呢?
如果我尝试使用停止点单步执行,程序不会继续执行下一步,但窗体会继续运行,就好像没有运行 vba 代码一样。这很烦人,因为这意味着表单仍然可以使用,就好像没有任何问题一样,但预期的行为没有发生。
My program doesn't process past this statement:
Dim valid as Boolean
If MyComboBox.Value Is Not Null Then valid = true
Why not?
If I try to step through using stop points the program does not proceed to the next step, but the form keeps running as if no vba code is being run. This is annoying because it means the form can still be used as if nothing is wrong but the intended behavior is not occuring.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
IS 关键字用于测试对象的状态并且您想要测试一个值。以下工作正常:
请参阅以下链接以获取更详细的说明:
什么都没有?空的?丢失的?空?
The IS keyword is used for testing the state of objects and you want to test a value. The following works fine:
See the following link for a more detailed description:
Nothing? Empty? Missing? Null?
以这种方式使用此函数(至少在 Excel 中)会引发错误,因为
Null
AFAIK 只能用于测试对象(并且 value 属性不是对象)。因此...如果您想在组合框中至少有一个选定值时设置 valid = TRUE,我相信我会使用
valid = CBool(Len(MyCombobox.Value) )
希望它有帮助......并希望我没有误解你的问题:-)
Use this function this way (at least in Excel) raises an error, because
Null
AFAIK can only be used to test objects (and the value property is not an object).Therefore... if you want to set valid =
TRUE
when there is at least one selected value in the Combobox, I believe I'd usevalid = CBool(Len(MyCombobox.Value))
Hope it helps... and hope I haven't misunderstand your question :-)