Click to See Complete Forum and Search --> : Goto


eng70640
April 1st, 2001, 02:53 PM
Is there a way to do something like this , suppose i am have finished executing a procedure in my module then i want to go to the last line of another procedure in my form. Is this possible?

sotoasty
April 1st, 2001, 06:12 PM
You can only branch to another line in the current Subroutine/Procedure. Using GOTO is not a very good solution in any case. What you should do, it break the procedure (where you want to jump to), into another procedure. Call it from both places you need to like....



public Sub FirstRoutine()

StuffIWantToDoInFirstRoutine
Call CommonRoutine

End Sub

public Sub SecondRoutine()

StuffIWantToDoInFirstRoutine
Call CommonRoutine

End Sub

public Sub CommonRoutine()

StuffIWantToDoInBothRoutines

End Sub




After you call the common routine, flow will continue back with the calling procedure.

Hope this helps

Cimperiali
April 4th, 2001, 05:21 AM
Excelent answer. If "eng" do not rate it, I do!

Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.