PC Review


Reply
Thread Tools Rate Thread

How can I switch errors back On?

 
 
Chris K
Guest
Posts: n/a
 
      19th Aug 2010

I understand that Resume signifies where/when the execution process can
continue but does this also switch errors back on? - it's not specifically
mentioned in the help files


 
Reply With Quote
 
 
 
 
Chris K
Guest
Posts: n/a
 
      19th Aug 2010
Seem to remember using

On Error Off

in the ol days but that doesn't work

"Chris K" <(E-Mail Removed)> wrote in message
news:1V7bo.96893$y_2.52649@hurricane...
>
> I understand that Resume signifies where/when the execution process can
> continue but does this also switch errors back on? - it's not specifically
> mentioned in the help files
>
>

 
Reply With Quote
 
Bob Quintal
Guest
Posts: n/a
 
      19th Aug 2010
"Chris K" <(E-Mail Removed)> wrote in
news:MW7bo.96894$y_2.84983@hurricane:

> Seem to remember using
>
> On Error Off
>
> in the ol days but that doesn't work
>
> "Chris K" <(E-Mail Removed)> wrote in message
> news:1V7bo.96893$y_2.52649@hurricane...
>>
>> I understand that Resume signifies where/when the execution
>> process can continue but does this also switch errors back on? -
>> it's not specifically mentioned in the help files
>>
>>

>

From Access 2003 help for the on error statement:

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

 
Reply With Quote
 
Bob Quintal
Guest
Posts: n/a
 
      19th Aug 2010
"Chris K" <(E-Mail Removed)> wrote in
news:MW7bo.96894$y_2.84983@hurricane:

> Seem to remember using
>
> On Error Off
>
> in the ol days but that doesn't work
>
> "Chris K" <(E-Mail Removed)> wrote in message
> news:1V7bo.96893$y_2.52649@hurricane...
>>
>> I understand that Resume signifies where/when the execution
>> process can continue but does this also switch errors back on? -
>> it's not specifically mentioned in the help files
>>
>>

>

From Access 2003 help for the on error statement:

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

 
Reply With Quote
 
David W. Fenton
Guest
Posts: n/a
 
      19th Aug 2010
"Chris K" <(E-Mail Removed)> wrote in
news:1V7bo.96893$y_2.52649@hurricane:

> I understand that Resume signifies where/when the execution
> process can continue but does this also switch errors back on? -
> it's not specifically mentioned in the help files


As I answered your other post:

On Error GoTo 0

I would suggest you open the VBE, type "error" into the immediate
window and hit F1. You'll get a list of help topics, and you should
have a read through the On Error Statement help topic.

By the way, I think I sent my previous answer before finishing it --
I'd intended to say something about the VBE options that interact
with your error handling. In A2003, on the GENERAL tab of the VBE
Options dialog, there's an option group for ERROR TRAPPING. I always
set this to BREAK IN CLASS MODULE. This has always seemed
counterintuitive, since BREAK ON ALL ERRORS or BREAK ON UNHANDLED
ERRORS seem like the right choice, but if you do that, it doesn't
work right with class modules (it breaks on the call to the class
module instead of on the error within the class module causing the
error). If you click the HELP button and read the discussion of the
choices, it becomes clear which is the best choic, but I must say
this is a case where the choices only make sense after you've read
the detailed explanation.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
 
Reply With Quote
 
David W. Fenton
Guest
Posts: n/a
 
      20th Aug 2010
"Allen Browne" <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> Resume Next (in the error handler) is of limited use -- only if
> you don't really care whether the faulting line worked or not.


Actually, if you have trapped for a specific error that you've
explicitly decided to ignore, that's a perfectly good reason for it.
Almost every case where someone posts code that uses On Error Resume
Next is one which, in my opinion, should be handled with an error
handler with a CASE SELECT that for the specific error number that
is being ignored passes control back to the next line.

This is bad:

On Error Resume Next
DoCmd.OpenReport "rptMyReport"
On Error GoTo 0
[do something else]

Say you're trapping for the NoData error (i.e., the report has no
data, and you've put Cancel = True in the report's OnNoData event)

On Error GoTo errHandler

DoCmd.OpenReport "rptMyReport"
[do something else]

exitRoutine:
Exit Sub

errHandler:
Select Case Err.Number
Case 2501 ' OpenReport cancelled
' ignore it
Resume Next
Case Else
MsgBox Err.Number & ": " & Err.Description, vbExclamation, _
"Error in OpenReport"
Resume exitRoutine
End Select

That's a case in which you specifically want to ignore one
particular error if it happens and continue on to the next line.
This is, in my opinion, the proper way to do it, i.e., using Resume
Next.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
 
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
3gb switch causing event errors drewex Windows XP General 7 12th Jan 2008 03:36 AM
How to switch back to XP from Vista Kalevi Windows XP Basics 6 21st Dec 2007 06:28 PM
How can I switch back to IE 6 from IE7 =?Utf-8?B?Q2F0dA==?= Windows XP Internet Explorer 4 14th Jan 2007 10:26 AM
Switch back OS? =?Utf-8?B?cmV0NDQyNQ==?= Windows Vista General Discussion 4 12th Sep 2006 10:46 PM
switch back to 98 kfox Microsoft Windows 2000 Upgrade 3 29th Jul 2003 08:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:19 AM.