我对“和”“或”语句如何协同工作感到困惑。我正在尝试使(某事或某事)语句作为“和”语句的一部分工作,但无法弄清楚逻辑问题由以下两个代码块说明。第一个工作正常..第二个失败,运行时错误 438:“对象不支持此属性或方法”。该错误是指“If j.Enabled...”行。在我看来,两者都应该运行..谁能详细说明为什么不是这样?
代码块 1(运行)
Private Sub Fini_cbn_Click()
Dim j As Control
For Each j In Controls
If j.Enabled = True And j.Tag = "4" Then
If j.Value = "<NA>" Or j.Value = "" Then
j.BackColor = &HFFFF&
Else
j.BackColor = &H80000005
End If
End If
Next j
End Sub
代码块 2(失败)
Private Sub Fini_cbn_Click()
Dim j As Control
For Each j In Controls
If j.Enabled = True And j.Tag = "4" And (j.Value = "<NA>" Or j.Value = "") Then
j.BackColor = &HFFFF&
Else
j.BackColor = &H80000005
End If
Next j
End Sub