On Error Resume Next question 
Author Message
 On Error Resume Next question

Hi,

I have a code sequence like:

Sub mySub()
   code
   code
   code

On Error Resume Next
   code
   code
   code

   code
   code
   code
End Sub

I actually don't want any general errorhandling since I want to be
able to debug the code. However, I wish  to use Resume Next on the
second part of the code (3 lines), but not on the last.

How do I "reset" the On Error Resume Next, so that I for the last part
of the code have no error handling?

---
Best regards
Morten Snedker
www.access-dk.mobilixnet.dk



Mon, 13 Jan 2003 03:00:00 GMT  
 On Error Resume Next question
From "On Error Statement" Help

On Error GoTo 0  
   Disables any enabled error handler in the current procedure.

Quote:

> Hi,

> I have a code sequence like:

> Sub mySub()
>    code
>    code
>    code

> On Error Resume Next
>    code
>    code
>    code

>    code
>    code
>    code
> End Sub

> I actually don't want any general errorhandling since I want to be
> able to debug the code. However, I wish  to use Resume Next on the
> second part of the code (3 lines), but not on the last.

> How do I "reset" the On Error Resume Next, so that I for the last part
> of the code have no error handling?

> ---
> Best regards
> Morten Snedker
> www.access-dk.mobilixnet.dk




Mon, 13 Jan 2003 03:00:00 GMT  
 On Error Resume Next question
On Thu, 27 Jul 2000 07:24:46 -0400, John Spencer

And I who normally encourages people to use the online help before
asking.... :-|

<Feel embarrased>

Quote:
>From "On Error Statement" Help

>On Error GoTo 0      
>   Disables any enabled error handler in the current procedure.

---
Mvh
Morten Snedker
www.access-dk.mobilixnet.dk


Mon, 13 Jan 2003 03:00:00 GMT  
 On Error Resume Next question
Morten,

You could use "On Error Goto 0".  However, this will break right away if
there was a previous error, so you'll want to clear any pre-existing error
(Err.Clear) prior to this line.

HTH,
Nicole


Quote:
> Hi,

> I have a code sequence like:

> Sub mySub()
>    code
>    code
>    code

> On Error Resume Next
>    code
>    code
>    code

>    code
>    code
>    code
> End Sub

> I actually don't want any general errorhandling since I want to be
> able to debug the code. However, I wish  to use Resume Next on the
> second part of the code (3 lines), but not on the last.

> How do I "reset" the On Error Resume Next, so that I for the last part
> of the code have no error handling?

> ---
> Best regards
> Morten Snedker
> www.access-dk.mobilixnet.dk




Mon, 13 Jan 2003 03:00:00 GMT  
 On Error Resume Next question

Huh? On Error Goto 0 clears the ErrorInfo object.

--
MichKa

random junk of dubious value at the multilingual
http://www.trigeminal.com/ and a new book on
i18N in VB at http://www.trigeminal.com/michka.asp


Quote:
> Morten,

> You could use "On Error Goto 0".  However, this will break right away if
> there was a previous error, so you'll want to clear any pre-existing error
> (Err.Clear) prior to this line.

> HTH,
> Nicole



> > Hi,

> > I have a code sequence like:

> > Sub mySub()
> >    code
> >    code
> >    code

> > On Error Resume Next
> >    code
> >    code
> >    code

> >    code
> >    code
> >    code
> > End Sub

> > I actually don't want any general errorhandling since I want to be
> > able to debug the code. However, I wish  to use Resume Next on the
> > second part of the code (3 lines), but not on the last.

> > How do I "reset" the On Error Resume Next, so that I for the last part
> > of the code have no error handling?

> > ---
> > Best regards
> > Morten Snedker
> > www.access-dk.mobilixnet.dk




Mon, 13 Jan 2003 03:00:00 GMT  
 On Error Resume Next question

Michael,

You're quite right, of course.  I haven't used Goto 0 since the old Access 2
days, and I'd quite forgotten...  Then something I read recently (in an MS
Press book of all places) implied that the error must be cleared, and I just
repeated the nonsense without checking first.  Posting with thinking once
again--one would think that I would have learned that lesson a few years
ago... <g>

Nicole



Quote:
> Huh? On Error Goto 0 clears the ErrorInfo object.

> --
> MichKa

> random junk of dubious value at the multilingual
> http://www.trigeminal.com/ and a new book on
> i18N in VB at http://www.trigeminal.com/michka.asp



> > Morten,

> > You could use "On Error Goto 0".  However, this will break right away if
> > there was a previous error, so you'll want to clear any pre-existing
error
> > (Err.Clear) prior to this line.

> > HTH,
> > Nicole



> > > Hi,

> > > I have a code sequence like:

> > > Sub mySub()
> > >    code
> > >    code
> > >    code

> > > On Error Resume Next
> > >    code
> > >    code
> > >    code

> > >    code
> > >    code
> > >    code
> > > End Sub

> > > I actually don't want any general errorhandling since I want to be
> > > able to debug the code. However, I wish  to use Resume Next on the
> > > second part of the code (3 lines), but not on the last.

> > > How do I "reset" the On Error Resume Next, so that I for the last part
> > > of the code have no error handling?

> > > ---
> > > Best regards
> > > Morten Snedker
> > > www.access-dk.mobilixnet.dk




Tue, 14 Jan 2003 03:00:00 GMT  
 On Error Resume Next question
No problem, Nicole. I do the same thing myself, lots of time.

--
MichKa

random junk of dubious value at the multilingual
http://www.trigeminal.com/ and a new book on
i18N in VB at http://www.trigeminal.com/michka.asp


Quote:
> Michael,

> You're quite right, of course.  I haven't used Goto 0 since the old Access
2
> days, and I'd quite forgotten...  Then something I read recently (in an MS
> Press book of all places) implied that the error must be cleared, and I
just
> repeated the nonsense without checking first.  Posting with thinking once
> again--one would think that I would have learned that lesson a few years
> ago... <g>

> Nicole


wrote

> > Huh? On Error Goto 0 clears the ErrorInfo object.

> > --
> > MichKa

> > random junk of dubious value at the multilingual
> > http://www.trigeminal.com/ and a new book on
> > i18N in VB at http://www.trigeminal.com/michka.asp



> > > Morten,

> > > You could use "On Error Goto 0".  However, this will break right away
if
> > > there was a previous error, so you'll want to clear any pre-existing
> error
> > > (Err.Clear) prior to this line.

> > > HTH,
> > > Nicole



> > > > Hi,

> > > > I have a code sequence like:

> > > > Sub mySub()
> > > >    code
> > > >    code
> > > >    code

> > > > On Error Resume Next
> > > >    code
> > > >    code
> > > >    code

> > > >    code
> > > >    code
> > > >    code
> > > > End Sub

> > > > I actually don't want any general errorhandling since I want to be
> > > > able to debug the code. However, I wish  to use Resume Next on the
> > > > second part of the code (3 lines), but not on the last.

> > > > How do I "reset" the On Error Resume Next, so that I for the last
part
> > > > of the code have no error handling?

> > > > ---
> > > > Best regards
> > > > Morten Snedker
> > > > www.access-dk.mobilixnet.dk




Tue, 14 Jan 2003 03:00:00 GMT  
 On Error Resume Next question

Quote:

>I actually don't want any general errorhandling since I want to be
>able to debug the code. However, I wish  to use Resume Next on the
>second part of the code (3 lines), but not on the last.

Hint:  In your error routine have the following:

tagError:
        msgbox err.description
        exit sub (or goto tagExit)
        resume

Of course the resume line will never be execute.  Or will it?  <smile>

Now when you get an error message hit Ctrl+Break.  Using your mouse
right click on the resume line and set it to the next statement.  Then
click on the execute one line button on the toolbar.  You will then be
returned to the offending line of code.   You can then fix things up
and still not have to be bothered with having to remove or setup any
error handling routines.

BTW this was mentioned in a local user group meeting.  I don't take
any credit for this idea.

Tony
----
Tony Toews, Microsoft Access MVP
   Please respond only in the newsgroups so that others can
read the entire thread of messages.
   Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
   VolStar http://www.volstar.com Manage hundreds or
thousands of volunteers for special events.



Sat, 18 Jan 2003 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. On local error resume next Vs on error resuem next

2. On Error Resume Next (but Only with Specific Error, like Err.Number = 70)

3. cmd.Errors.Count Not Working (On Error Resume Next)

4. Runtime error(3012): On error resume next

5. Wish List Vote: Resume and Resume Next in Try blocks

6. On Error Resume Next being ignored

7. Problem with On Error Resume Next in a converted database

8. On Error Resume Next has no effect

9. Resume Next doesn't trap error

10. ON ERROR RESUME NEXT Failure?

11. Undoing On Error Resume Next

12. On Error Resume Next

 

 
Powered by phpBB® Forum Software