473,406 Members | 2,369 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,406 software developers and data experts.

How to Exit Sub on Error?

Is there a shorthand way to Exit Sub On Error?

This does not seem to work:

On Error Exit Sub

And I don't want to use: On Error GoTo 0

Must I use: GoTo Exit_Here?

Nov 12 '05 #1
4 44533
On Fri, 16 Jan 2004 00:34:25 GMT, "deko" <dj****@hotmail.com> wrote:
Is there a shorthand way to Exit Sub On Error?

This does not seem to work:

On Error Exit Sub

And I don't want to use: On Error GoTo 0

Must I use: GoTo Exit_Here?


Yup. That's not so bad, though, is it?
Nov 12 '05 #2
On Fri, 16 Jan 2004 00:34:25 GMT, "deko" <dj****@hotmail.com> wrote:
Is there a shorthand way to Exit Sub On Error?

This does not seem to work:

On Error Exit Sub

And I don't want to use: On Error GoTo 0

Must I use: GoTo Exit_Here?

Sub Something()
On Error GoTo Err_Handler
' Do your stuff here
Exit_This_Sub:
Exit Sub
Err_Handler:
Resume Exit_This_Sub
End Sub
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.
Nov 12 '05 #3
no.... was just curious if there was a better way...

thanks for the reply

"Steve Jorgensen" <no****@nospam.nospam> wrote in message
news:us********************************@4ax.com...
On Fri, 16 Jan 2004 00:34:25 GMT, "deko" <dj****@hotmail.com> wrote:
Is there a shorthand way to Exit Sub On Error?

This does not seem to work:

On Error Exit Sub

And I don't want to use: On Error GoTo 0

Must I use: GoTo Exit_Here?


Yup. That's not so bad, though, is it?

Nov 12 '05 #4
try something like:

Function F_VAL_MyScreen(MyForm As Form) As Boolean
On Error GoTo F_VAL_MyScreen_Err:
F_VAL_MyScreen = False

blah, blah, blah

F_VAL_MyScreen = True
F_VAL_MyScreen_EXIT:
Exit Function

F_VAL_MyScreen_Err:
If Err.Number <> 0 Then
Call F_WL("E", -1, Err, MyForm.Name, "F_VAL_MyScreen", "", "", "",
"", Err.Number & " - " & Err.Description)
Resume F_VAL_MyScreen_EXIT:
Else
GoTo F_VAL_MyScreen_EXIT:
End If

End Function

John Bickmore
www.BicycleCam.com
www.Feed-Zone.com

"deko" <dj****@hotmail.com> wrote in message
news:lk******************@newssvr27.news.prodigy.c om...
Is there a shorthand way to Exit Sub On Error?

This does not seem to work:

On Error Exit Sub

And I don't want to use: On Error GoTo 0

Must I use: GoTo Exit_Here?

Nov 12 '05 #5

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

Similar topics

1
by: Dan | last post by:
Hi, I am using the Employee.fdb sample that comes with Firebird 1.5.1. Everything resides on a WinXP Pro pc. I set up an ODBC connection called "FB Employee Sample" and tested it with MS Access...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
0
by: Pierre | last post by:
Hi all, win xp, msaccess 2003 recently upgrade, msoffice 2000 recently upgrade. Since i upgrade office i have the above message each time.(a system error...) I click ok, office close, then i...
3
by: Smriti Dev | last post by:
Hi There, I have the following code and when I try to run it, I get a type mismatch error. I would really appreciate your help with this. Thanks kindly, smriti --- Private Sub cmdOK_Click()
3
by: Mike Johnson | last post by:
I have the following code in form1 and when the application starts this sub is called to check for a path if not found a message box is displayed and then gives the user an option to end the...
2
by: Mike Johnson | last post by:
The sub is being called from the Sub New(). If I can't use Application.Exit() in this situation then how do I exit the application? please help. Public Sub Check_For_Dir() Dim MyPath, MyName As...
1
by: connoisseur.infotech | last post by:
i have schedule a .exe of VB6.0 on a remote computer and when that exe run out i got this message in scheduler. operating system is window server 2003 where i have scheduled it. This program...
3
by: GinTon | last post by:
Is the same use _sys.stderr.write('error message'); sys.exit(1)_ than _sys.exit('error message')_ ? Note: help(sys.exit) If the status is omitted or None, it defaults to zero (i.e., success)....
3
by: faz | last post by:
Hai, i have used exit(1) in my code and included conio.h file also but it is giving the following.. error C2065: 'exit' : undeclared identifier pls suggest me
6
by: mikemtnbikes | last post by:
Hello, I'm a biologist who does a fair amount of hack programming. I'm not really formally trained so perhaps this question is a bit basic. My problem is that I'm trying to understand some...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.