-
From within Sub1 I call to Sub2, from there Icall to Sub3 This is:
Sub1->Sub2->Sub3
The back way must be: Sub3->Sub2->Sub1
But the back way it takes is Sub3->Sub1 and all the code after I called the Sub3 is omitted!!
Sub1 is into a Form and Sub2 and Sub3 are into a Module.
-
Code:
Sub One
Print "Sub1Start"
Call Two
Print "Sub1End"
End Sub
Sub Two
Print "Sub2Start"
Call Three
Print "Sub2End"
End Sub
Sub Three
Print "Sub3Start"
Print "Sub3End"
End Sub
Your code:
It should output like this:
Sub1Start
Sub2Start
Sub3Start
Sub3End
Sub2End
Sub1End
-
That is the result I must get but the real result I get is (into my complete code) :
Sub1Start
Sub2Start
Sub3Start
Sub3End
Sub1End
It omits the Sub2End.
Obviously I must have anything into my code so that I get this rare result, but What could it be the problem?
-
Are you sure you don't have an exit sub statement somehwere in your second sub?
Try this: Create a new project, add the code I gave you into a button, press the button and post the results.
-
Or step through your code and watch what happens using the debugger. An error handler or GoTo may also be the culprit.
-
Megatron, seaweed:
I did what you say, from the End Sub line of the Sub3, it jumps to the next line on Sub1
Of course I I oen a new project and put the code that Megatron gave me, it works. The problem is not constant, is an extrange behavior just into my actual program.
I traced it several times and I apparently don't have any exit sub or another statament that make this rare behavior.
-
Post the subs. (If they are too big to post, zip them and attach them to your post).
We will get to the bottom of this!! :)