我使用的是简单的IF语句,但是当出于某种原因点击命令按钮时,它们就会被忽略。
我错过了什么?
If Text4 = "" Then
MsgBox "You must add a GS Reference", vbInformation
Exit Sub
Else
End If
If Text6 = "" Then
MsgBox "You must add a Service Account number", vbInformation
Exit Sub
Else
End If
If Text8 = "" Then
MsgBox "You must pick an advisor", vbInformation
Exit Sub
Else
End If
If Me.Text10 = "" Then
MsgBox "You must select a date received option", vbInformation
Exit Sub
Else
End If
If Me.Text12 = "" Then
MsgBox "You must select a date failed option", vbInformation
Exit Sub
Else
End If
对我来说,这些应该只是检查文本框是否为空白,如果空白则显示一条消息,即停止运行代码。但它根本不起作用。
答案 0 :(得分:4)
尝试用以下命令替换检查文本框:
If Nz(Text6,"") = "" Then
或
If Len(Nz(Text6,"") = 0 Then
最后一个工作得快一点