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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to conditionally exit a sub?

Status
Not open for further replies.

ctlin

Technical User
Apr 17, 2002
77
US
the following code doesn't work for some reason- when i run it i get a popup saying:
"Compile error: Block If without End If"

i am trying to get the sub to exit if all fields have not been filled properly. something to the effect of undoing the submit click i suppose. thanks
--------------
Private Sub Command1_Click()

For i = 1 To 7
If promptArray(i) = "" Then
End Sub '<-----problem with this line
End If
Next i

End Sub
 
i suspect the &quot;End Sub&quot; is not the proper way to break out of a sub
 
Private Sub Command1_Click()

For i = 1 To 7
If promptArray(i) = &quot;&quot; Then
Exit Sub '<-----problem with this line
End If
Next i

End Sub Anything is possible, the problem is I only have one lifetime.
[cheers]
 
thanks! i was about to post that i figured it out, but it appears that the board is faster than i am... no more trivial questions today. i promise.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top