Jumping

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to jump to the end of a procedure? In the middle of my
procedure, if a field is null, I want a message box to alert the user, then
jump to the end, and not execute the remaining lines of code. I realize I
could wrap everything up in the various IF statements, but there are over
five of them and I don't like to nest that deep. And while I am asking these
questions, is there anywhere I can lookup all code verbiage so I don't have
to bother you wonderful people with such mundane questions. Thanks again.
Michael
 
apollo8359 said:
Is there a way to jump to the end of a procedure? In the middle of my
procedure, if a field is null, I want a message box to alert the user, then
jump to the end, and not execute the remaining lines of code. I realize I
could wrap everything up in the various IF statements, but there are over
five of them and I don't like to nest that deep. And while I am asking these
questions, is there anywhere I can lookup all code verbiage so I don't have
to bother you wonderful people with such mundane questions. Thanks again.


I tend toward Exit Sub in spite of the general guidline of a
single exit point.

Alternatives to avoid the nesting issue are to use ElseIf or
Select Case.

If condition1 Then
...
ElseIf condition2 Then
...
Else
...
....
End If

Select Case True
Case condition1
...
Case condition2
...
....
Case Else
...
End Select
 
Back
Top