我正在使用简单的IF语句,但由于某些原因,单击命令按钮时它们会被忽略。简单的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
对我来说,这些应该只是检查如果一个文本框是空白的,如果空白显示一条消息停止运行代码。但它根本不工作。
当然,你已经用破发点已经调试代码和单步执行?如果没有,请这样做。如果您已经这样做了,请将相关信息添加到您的问题中。 – Heinzi
除了@Heinzi,记住null不是零长度的字符串。 – Fionnuala
@Fionnuala是对的。使用:如果IsNull(Me!Text10.Value)Then'。 – Gustav