Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if none of edit boxes are null 2

Status
Not open for further replies.

kennetha

Programmer
Sep 10, 2003
105
0
0
MT
Hi all,

I have five edit boxes in a form which ex a code. I want to stop code if all edit boxes are Null but not if one or more is filled with data.

I tried the code below but with no success for obvious reasons- still not know how to proceed.

If IsNull(Me.a1) Or IsNull(Me.a2) Or IsNull(Me.a3) Or IsNull(Me.a4) Or IsNull(Me.a5) Then
MsgBox "Nothing to Print. " & Chr(10) & Chr(13) & "Please post Picking Numbers in 1,2... ", , pro
call cmdclearallnumbers_Click
Exit Sub
End If

...where a1 to a5 are the edit boxes
Can someone help please

Thanks in advance
Kenneth.
 
It seems likely that the boxes are not null:

Code:
If Len(Trim(Me.a1) & Trim(Me.a2) & Trim(Me.a3) & Trim(Me.a4) & Trim(Me.a5))>0 Then
    MsgBox "Nothing to Print.   " & Chr(10) & Chr(13) & "Please post Picking Numbers in 1,2...   ", , pro
    call cmdclearallnumbers_Click
Exit Sub
End If


 
If Trim(Me!a1 & Me!a2 & Me!a3 & Me!a4 & Me!a5 & "") = "" Then
MsgBox "Nothing to Print. " & Chr(10) & Chr(13) & "Please post Picking Numbers in 1,2... ", , pro
...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for the advise. It worked with a slight code variation and is below:

If IsNull(Len(Trim(Me.a1) & Trim(Me.a2) & Trim(Me.a3) & Trim(Me.a4) & Trim(Me.a5))) Then
MsgBox "Nothing to Print. " & Chr(10) & Chr(13) & "Please post Picking Numbers in 1,2... ", , pro
call cmdclearallnumbers_Click
Exit Sub
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top