PC Review


Reply
Thread Tools Rate Thread

Inheritance and On Error Resume Next

 
 
MDW
Guest
Posts: n/a
 
      10th Nov 2003
Say I've got one sub that calls various other subs. If I
put "On Error Resume Next" in the parent sub (the one
doing all the calling), will that carry through to the
child subs (the ones being called)?

Using Access 97 if it makes a difference.
 
Reply With Quote
 
 
 
 
Dev Ashish
Guest
Posts: n/a
 
      10th Nov 2003
"MDW" <(E-Mail Removed)> wrote in news:026f01c3a7b5
$19012350$(E-Mail Removed):

> Say I've got one sub that calls various other subs. If I
> put "On Error Resume Next" in the parent sub (the one
> doing all the calling), will that carry through to the
> child subs (the ones being called)?


No... What happens in this case is that the error generated in a child
sub gets bubbled up to the caller where the Resume Next statement kicks
in. To illustrate:

Sub A()
On Error Resume Next
Call SubB
Msgbox "in SubA"
End Sub

Sub B()
Err.Raise 5
Msgbox "in SubB"
End Sub

In this case, you will never see the msgbox from Sub B but Msgbox from
SubA should display without problems.

If, however, you add Resume Next to Sub B:

Sub B()
On Error Resume next
Err.Raise 5
Msgbox "in SubB"
End Sub

Now, you should see both the msgboxes. (Air code)

PS: 'Inheritance' is a totally unrelated and different term altogether
and doesn't apply in this context.

-- Dev
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: On error resume next doesn't resume next Klatuu Microsoft Access VBA Modules 0 20th Mar 2008 08:32 PM
ON RESUME PASSWORD PROTECT vs ON RESUME DISPLAY WELCOME SCREEN Information Scavenger Windows XP Work Remotely 5 17th Dec 2004 09:36 PM
ON RESUME PASSWORD PROTECT vs ON RESUME DISPLAY WELCOME SCREEN Information Scavenger Windows XP Help 0 29th Sep 2004 10:05 PM
Inheritance Error =?Utf-8?B?UGFydmVlbg==?= Microsoft VB .NET 1 4th May 2004 08:06 PM
Inheritance Error!!! Need help so much Hai Nguyen Microsoft ASP .NET 4 12th Jan 2004 06:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:07 AM.