473,386 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Exit many procedure with one command

Hello

Is there a way to exit all running procedures with one command?

Sometimes a procedure(1) will call another procedure(2) which could call a
third procedure(3) and what I would like to do is give a command in
procedure(3) that would exit all three procedure without returning to
procedure(1) and procedure(2)

Example: I have hundreds of procedures and all of them call a function
(MyErrHandle) to handle any error that might happen during the procedure.

Private Sub Command0_Click()

On Error GoTo err_Handle



Exit Sub

err_Handle:

Call MyErrHandle

Resume Next

End Sub

Normally MyErrHandle will log the error and sometimes display a message and
then Resume Next upon returning from MyErrHandle. For certain errors,
however, I would like to exit the Command0_Click procedure instead of Resume
Next.

I know I could write the following code after Call MyErrHandle

Exit Sub

err_Handle:

Call MyErrHandle

If Err.Number = 3084 then

Exit Sub

Else

Resume Next

End if

End Sub

But if I could stop or exit the Command0_Click procedure from the
MyErrHandle or not return to Command0_Click from MyErrHandle it would save
me from going through all my hundreds of procedures and retype more error
handling codes.

Also the command has to not upset the functioning of the application to much
and requiring the application to be shut down and reopened.

I am using MSACCESS 2000

Thanks
G Gerard
Feb 15 '06 #1
2 5921
On Wed, 15 Feb 2006 02:41:13 GMT, "GGerard" <gg*****@nbnet.nb.ca>
wrote:

Well, if you ONLY have an error handler in the toplevel procedure, and
an (unhandled) error occurs in a subprocedure, your toplevel error
handler will get control. So effectively you have exited all running
procedures, with zero commands :-)

-Tom.

Hello

Is there a way to exit all running procedures with one command?

Sometimes a procedure(1) will call another procedure(2) which could call a
third procedure(3) and what I would like to do is give a command in
procedure(3) that would exit all three procedure without returning to
procedure(1) and procedure(2)

Example: I have hundreds of procedures and all of them call a function
(MyErrHandle) to handle any error that might happen during the procedure.

Private Sub Command0_Click()

On Error GoTo err_Handle



Exit Sub

err_Handle:

Call MyErrHandle

Resume Next

End Sub

Normally MyErrHandle will log the error and sometimes display a message and
then Resume Next upon returning from MyErrHandle. For certain errors,
however, I would like to exit the Command0_Click procedure instead of Resume
Next.

I know I could write the following code after Call MyErrHandle

Exit Sub

err_Handle:

Call MyErrHandle

If Err.Number = 3084 then

Exit Sub

Else

Resume Next

End if

End Sub

But if I could stop or exit the Command0_Click procedure from the
MyErrHandle or not return to Command0_Click from MyErrHandle it would save
me from going through all my hundreds of procedures and retype more error
handling codes.

Also the command has to not upset the functioning of the application to much
and requiring the application to be shut down and reopened.

I am using MSACCESS 2000

Thanks
G Gerard


Feb 15 '06 #2
There is no good way to do it like that.

You can use End to exit all code, it also clears all variables.

You can use err.raise to go to the next error handler - you can record the
error, but you should only report the error at the top level.

(david)

"GGerard" <gg*****@nbnet.nb.ca> wrote in message
news:dx********************@ursa-nb00s0.nbnet.nb.ca...
Hello

Is there a way to exit all running procedures with one command?

Sometimes a procedure(1) will call another procedure(2) which could call a
third procedure(3) and what I would like to do is give a command in
procedure(3) that would exit all three procedure without returning to
procedure(1) and procedure(2)

Example: I have hundreds of procedures and all of them call a function
(MyErrHandle) to handle any error that might happen during the procedure.

Private Sub Command0_Click()

On Error GoTo err_Handle



Exit Sub

err_Handle:

Call MyErrHandle

Resume Next

End Sub

Normally MyErrHandle will log the error and sometimes display a message
and then Resume Next upon returning from MyErrHandle. For certain errors,
however, I would like to exit the Command0_Click procedure instead of
Resume Next.

I know I could write the following code after Call MyErrHandle

Exit Sub

err_Handle:

Call MyErrHandle

If Err.Number = 3084 then

Exit Sub

Else

Resume Next

End if

End Sub

But if I could stop or exit the Command0_Click procedure from the
MyErrHandle or not return to Command0_Click from MyErrHandle it would
save me from going through all my hundreds of procedures and retype more
error handling codes.

Also the command has to not upset the functioning of the application to
much and requiring the application to be shut down and reopened.

I am using MSACCESS 2000

Thanks
G Gerard

Feb 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
3
by: Gary | last post by:
I am developing a simple DB-Library program in C calling SQL Server 2000 on windows 2003 and NT 4. I have some T-SQL code that checks for the existence of a table and want to abort the program if...
5
by: Gustavo Randich | last post by:
Hello, I'm writing an automatic SQL parser and translator from Informix to DB2. Now I'm faced with one of the most difficult things to translate, the "foreach execute procedure" functionality...
2
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
8
by: Suresh | last post by:
Hi All I have one STATES table with two fields (STATECODE, NAME). I had written following stored procedure on this table CREATE PROCEDURE ESCRIP.STATES_GETALL(OUT @ERRORCODE INT, OUT...
23
by: Tina | last post by:
In vb.net to get out of a sub or a function we can say Exit Sub. How can I get out of a void method in C#. I can't find that documented anywhere. Thanks, T
6
by: MLH | last post by:
I have a form, frmUSPSReturnReceipts, with a control named NotExpectingGreenTickets. The control's Exit event procedure follows: Private Sub NotExpectingGreenTickets_Exit(Cancel As Integer) If...
2
by: jed | last post by:
I have created this example in sqlexpress ALTER PROCEDURE . @annualtax FLOAT AS BEGIN SELECT begin1,end1,deductedamount,pecentageextra FROM tax
0
by: SOI_0152 | last post by:
Hi all! Happy New Year 2008. Il hope it will bring you love and happyness I'm new on this forum. I wrote a stored procedure on mainframe using DB2 7.1.1 and IBM language c. Everything works...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.