VBA验证无法正常工作 [英] VBA validation not working properly
本文介绍了VBA验证无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果单击 submit (提交)按钮但没有任何反应,则 cbo_moduleName
字段为空,我正尝试返回一条错误消息.
I'm trying to return an error message if the cbo_moduleName
field is empty once the submit button is clicked but nothing is happening.
Private Sub btnSubmit_Click()
If IsEmpty(cbo_moduleName.Value) Then
MsgBox ("Module Name field empty!")
Exit Sub
End If
End Sub
知道我在哪里犯错吗?
推荐答案
IsEmpty
检查类型 Variant
的变量是否包含特殊值 Empty
.
IsEmpty
checks whether a variable of type Variant
contains a special value Empty
.
您可能的意思是检查字符串是否为空字符串:
What you probably meant is checking if a string is an empty string:
If Len(cbo_moduleName.Value) = 0 Then
...
End If
这篇关于VBA验证无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文