Can someone help me figure out why this if statement isn't working properly? The expectation is that if any of the first 5 fields are not null AND one of the first 4 fields are null, it should throw an error. (It is ok for the first 4 fields to be not null, and the 5th field to be null). What's happening is, I'm getting an error even when there's no data in any of the 5 fields.
txt_CTIStart
txt_CTI1stPymt
txt_CTIPymtAmt
cobo_CTIFreq
txt_CTIAmtPaid
txt_CTIStart
txt_CTI1stPymt
txt_CTIPymtAmt
cobo_CTIFreq
txt_CTIAmtPaid
Code:
If (Not Len(Me.txt_CTIStart.Value) = 0 Or Not Len(Me.txt_CTI1stPymt.Value) = 0 Or (Me.txt_CTIPymtAmt.Value) > 0 Or Not Len(Me.cobo_CTIFreq.Value) = 0 Or _
(Me.txt_CTIAmtPaid.Value) > 0) And (Len(Me.txt_CTIStart.Value) = 0 Or Len(Me.txt_CTI1stPymt.Value) = 0 Or Len(Me.txt_CTIPymtAmt.Value) = 0 Or Len(Me.cobo_CTIFreq.Value) = 0) Then
MsgBox "Please complete the partial information in the CT-I section."
If Response = vbOK Then Me.txt_CTIStart.SetFocus
Exit Sub
End If