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

Cancel execution of Private Sub when you call another Sub

Status
Not open for further replies.

ralstat

Programmer
Jan 5, 2002
3
US
I have several Private Subs that call OTHER private subs. If these new subs are called I would like to cancel the execution of the first sub (i.e. I don't want the new sub to be executed and then RETURN to the first sub to continue execution).

How can I do this?
 
If you are using If statements to determine whether to run a Private sub or not, simple put an Exit Sub befor the Endif.

A generic example would be:

If dblSum > 100 then
Create_Invoice ' this is the Private sub call
Exit Sub ' this will get you out of the rest of this sub
endif

Let me know if this helps.
 
That would normally work... The problem is that the first sub's process continues while the second sub executes. My problem is that I can't get code in my second sub to execute while another sub's process still exists (my first sub is an "Before Update" event, and my second sub is trying to save a record... you can't save a record until the Before Update event is canceled).

 
Could you describe the process more?
Are you trying to save the same data in the second sub that also triggers the Before Update (first sub)?
What else are you doing in the Before Update event?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top