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

Exit Sub vs. GoTo ProcExit: - Am I just being old-fashioned?

Status
Not open for further replies.

bjm1335

Programmer
Jan 25, 2002
44
US
I was taught a LONG time ago (before most of you were born, I'm sure) that there should be one entry point and one exit point to a proc/pgm/whatever. Being new to VB, I started using the the following "template" which is similar to what I've used in other languages:

Private Sub xxx_GotFocus()
On Error GoTo ErrRtn:

If Not blnEditRec And Not blnNewRec then GoTo ProcExit:
.
.
ProcExit:
Exit Sub

ErrRtn:
Call DisplayErrMsg(xxx, yy, zzz)
Resume ProcExit:
End Sub

Do you guys feel it's an OK practice to use:

"If Not blnEditRec And Not blnNewRec Then Exit Sub"

in place of the GoTo ProcExit:?

I actually just started implementing a CallStack which
REQUIRES I have 1 entry/exit in order to properly maintain the stack, but I just wondered in general about the process.

Any and all comments welcome.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top