Condition Not Satisfying With Text Data

Ashfaque

Search Beautiful Girls from your town for night
Local time
Today, 09:34
Joined
Sep 6, 2004
Messages
897
Below are all text fields on form. I m trying to check if all are empty then msg and drop the execution at a click of a btn.

Dim MyCheck As String
If (IsNull(Me.FirstTime) Or IsNull(Me.SecondTime)) And (IsNull(Me.ThirdTime) Or IsNull(Me.FourthTime)) Then
MsgBox ("Please Enter Action"), vbCritical
....
....

But doesn't works. I need to check if all above fields are empty or not. If anyone of them have value, then further process.

Any help?

Thanks,
 
Below are all text fields on form. I m trying to check if all are empty then msg and drop the execution at a click of a btn.

Dim MyCheck As String
If (IsNull(Me.FirstTime) Or IsNull(Me.SecondTime)) And (IsNull(Me.ThirdTime) Or IsNull(Me.FourthTime)) Then
MsgBox ("Please Enter Action"), vbCritical
....
....

But doesn't works. I need to check if all above fields are empty or not. If anyone of them have value, then further process.

Any help?

Thanks,


Perhaps:
If (IsNull(Me.FirstTime) Or IsNull(Me.SecondTime)) OR (IsNull(Me.ThirdTime) Or IsNull(Me.FourthTime)) Then
MsgBox ("Please Enter Action"), vbCritical
 
Thanks Bob,

But your code still displays the msg even there is value in one of the above fields.

Any other idea..?
 
Is it possible you have zero length strings?
you can check for both null and zls with Nz(yourField,"") <> ""
 

Users who are viewing this thread

Back
Top Bottom