[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Marv

6/15/2011 9:54:00 PM

Why would the following statements prevent from getting a Error53 - File
not found error when there is no file with this extension? Does the
wild card symbol cause the problem?

On Error Resume Next
Kill "C:\Financial\*.csv"
On Error Goto 0

Marv

10 Answers

Dee Earley

6/16/2011 7:54:00 AM

0

On 15/06/2011 22:53, Marv wrote:
> Why would the following statements prevent from getting a Error53 - File
> not found error when there is no file with this extension? Does the wild
> card symbol cause the problem?
>
> On Error Resume Next
> Kill "C:\Financial\*.csv"
> On Error Goto 0

Because you tell it to ignore all errors.
If the pattern doesn't match anything, Kill() errors as normal, even
with wildcards.

--
Dee Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk...

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)

Jeff Johnson [MVP: VB]

6/16/2011 2:17:00 PM

0

"Marv" <NoBdy@columbus.rr.com> wrote in message
news:itb9kq$d54$1@speranza.aioe.org...

> Why would the following statements prevent from getting a Error53 - File
> not found error when there is no file with this extension? Does the wild
> card symbol cause the problem?

> On Error Resume Next <<<=== BECAUSE OF THIS!!!
> Kill "C:\Financial\*.csv"
> On Error Goto 0


Marv

6/17/2011 2:07:00 PM

0

On 6/16/2011 3:54 AM, Deanna Earley wrote:
> On 15/06/2011 22:53, Marv wrote:
>> Why would the following statements prevent from getting a Error53 - File
>> not found error when there is no file with this extension? Does the wild
>> card symbol cause the problem?
>>
>> On Error Resume Next
>> Kill "C:\Financial\*.csv"
>> On Error Goto 0
>
> Because you tell it to ignore all errors.
> If the pattern doesn't match anything, Kill() errors as normal, even
> with wildcards.
>
I did not phrase the situation properly. I GET the File Not Found
Error message and do not see why I do. I would think that the Resume
Next should prevent from getting the error.

(nobody)

6/17/2011 2:25:00 PM

0

Marv wrote:
> On 6/16/2011 3:54 AM, Deanna Earley wrote:
>> On 15/06/2011 22:53, Marv wrote:
>>> Why would the following statements prevent from getting a Error53 -
>>> File not found error when there is no file with this extension?
>>> Does the wild card symbol cause the problem?
>>>
>>> On Error Resume Next
>>> Kill "C:\Financial\*.csv"
>>> On Error Goto 0
>>
>> Because you tell it to ignore all errors.
>> If the pattern doesn't match anything, Kill() errors as normal, even
>> with wildcards.
>>
> I did not phrase the situation properly. I GET the File Not Found
> Error message and do not see why I do. I would think that the Resume
> Next should prevent from getting the error.

Right click the code window and check "Toggle" sub menu. If it's set to
"Break on All Errors", then that's expected. In this case, the IDE will
break on any error, whether you have "On Error Goto SomeLabel" or "On Error
Resume Next", or not. This is useful for troubleshooting what errors are
occurring that might be "hidden" and it's a fast way of simulating that you
have commented out all "On Error..." statements temporarily.

Also see VB IDE Tools-->Options-->General tab-->Error Trapping. The default
is "Break in Class Module" in the IDE options and code window.




Darksaint

6/17/2011 2:38:00 PM

0

Marv wrote:

> On 6/16/2011 3:54 AM, Deanna Earley wrote:
>
>> On 15/06/2011 22:53, Marv wrote:
>>
>>> Why would the following statements prevent from getting a Error53 - File
....

>>> On Error Resume Next
>>> Kill "C:\Financial\*.csv"
>>> On Error Goto 0
>>
>> Because you tell it to ignore all errors.
>> If the pattern doesn't match anything, Kill() errors as normal, even
>> with wildcards.
>>
> I did not phrase the situation properly. I GET the File Not Found
> Error message and do not see why I do. I would think that the Resume
> Next should prevent from getting the error.

Read the documentation on error handling thoroughly...

> An "enabled" error handler is one that is turned on by an On Error
> statement; an "active" error handler is an enabled handler that is in
> the process of handling an error. If an error occurs while an error
> handler is active (between the occurrence of the error and a Resume,
> Exit Sub, Exit Function, or Exit Property statement), the current
> procedure's error handler can't handle the error. Control returns to the
> calling procedure. If the calling procedure has an enabled error
> handler, it is activated to handle the error.
>

There's insufficient context posted to tell for certain but one would

surmise there's an enabled error handler at caller level that is being invoked.


--


Henning

6/17/2011 4:18:00 PM

0


"Marv" <NoBdy@columbus.rr.com> skrev i meddelandet
news:itfn1s$5dc$1@speranza.aioe.org...
> On 6/16/2011 3:54 AM, Deanna Earley wrote:
>> On 15/06/2011 22:53, Marv wrote:
>>> Why would the following statements prevent from getting a Error53 - File
>>> not found error when there is no file with this extension? Does the wild
>>> card symbol cause the problem?
>>>
>>> On Error Resume Next
>>> Kill "C:\Financial\*.csv"
>>> On Error Goto 0
>>
>> Because you tell it to ignore all errors.
>> If the pattern doesn't match anything, Kill() errors as normal, even
>> with wildcards.
>>
> I did not phrase the situation properly. I GET the File Not Found Error
> message and do not see why I do. I would think that the Resume Next should
> prevent from getting the error.

Insert an Err.Clear before On Error Goto 0

/Henning


Dee Earley

6/17/2011 4:38:00 PM

0

On 17/06/2011 17:18, Henning wrote:
> "Marv"<NoBdy@columbus.rr.com> skrev i meddelandet
> news:itfn1s$5dc$1@speranza.aioe.org...
>> On 6/16/2011 3:54 AM, Deanna Earley wrote:
>>> On 15/06/2011 22:53, Marv wrote:
>>>> Why would the following statements prevent from getting a Error53 - File
>>>> not found error when there is no file with this extension? Does the wild
>>>> card symbol cause the problem?
>>>>
>>>> On Error Resume Next
>>>> Kill "C:\Financial\*.csv"
>>>> On Error Goto 0
>>>
>>> Because you tell it to ignore all errors.
>>> If the pattern doesn't match anything, Kill() errors as normal, even
>>> with wildcards.
>>>
>> I did not phrase the situation properly. I GET the File Not Found Error
>> message and do not see why I do. I would think that the Resume Next should
>> prevent from getting the error.
>
> Insert an Err.Clear before On Error Goto 0

On Error implicitly clears the error value when it's called.

Also, that would only "show" the erro if they explicitly checked
err.number afterwards.

--
Dee Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk...

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)

Henning

6/17/2011 6:19:00 PM

0


"Deanna Earley" <dee.earley@icode.co.uk> skrev i meddelandet
news:itfvts$u0b$1@speranza.aioe.org...
> On 17/06/2011 17:18, Henning wrote:
>> "Marv"<NoBdy@columbus.rr.com> skrev i meddelandet
>> news:itfn1s$5dc$1@speranza.aioe.org...
>>> On 6/16/2011 3:54 AM, Deanna Earley wrote:
>>>> On 15/06/2011 22:53, Marv wrote:
>>>>> Why would the following statements prevent from getting a Error53 -
>>>>> File
>>>>> not found error when there is no file with this extension? Does the
>>>>> wild
>>>>> card symbol cause the problem?
>>>>>
>>>>> On Error Resume Next
>>>>> Kill "C:\Financial\*.csv"
>>>>> On Error Goto 0
>>>>
>>>> Because you tell it to ignore all errors.
>>>> If the pattern doesn't match anything, Kill() errors as normal, even
>>>> with wildcards.
>>>>
>>> I did not phrase the situation properly. I GET the File Not Found
>>> Error
>>> message and do not see why I do. I would think that the Resume Next
>>> should
>>> prevent from getting the error.
>>
>> Insert an Err.Clear before On Error Goto 0
>
> On Error implicitly clears the error value when it's called.
>
> Also, that would only "show" the erro if they explicitly checked
> err.number afterwards.
>
> --
> Dee Earley (dee.earley@icode.co.uk)
> i-Catcher Development Team
> http://www.icode.co.uk...
>
> iCode Systems
>
> (Replies direct to my email address will be ignored.
> Please reply to the group.)

After an On Error Resume Next???
On Error Goto 0, say it disables errorhandling in the current procedure, not
that it clears Err.Number.

Easy to check with a MsgBox before and after On Error Goto 0, with and
without Err.Clear.

/Henning


Dee Earley

6/20/2011 7:49:00 AM

0

On 17/06/2011 19:18, Henning wrote:
> "Deanna Earley"<dee.earley@icode.co.uk> skrev i meddelandet
> news:itfvts$u0b$1@speranza.aioe.org...
>> On Error implicitly clears the error value when it's called.
>
> After an On Error Resume Next???
> On Error Goto 0, say it disables errorhandling in the current procedure, not
> that it clears Err.Number.
>
> Easy to check with a MsgBox before and after On Error Goto 0, with and
> without Err.Clear.

I did, that's why I said it :)

On Error Resume Next
Err.Raise 5
Debug.Print Err
Debug.Print Err
On Error GoTo 0
Debug.Print Err

prints:
5
5
0

--
Dee Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk...

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)

Mayayana

6/20/2011 1:00:00 PM

0

| After an On Error Resume Next???
| On Error Goto 0, say it disables errorhandling in the current procedure,
not
| that it clears Err.Number.
|

x = 1
y = 1
On Error Resume Next
x = y \ 0
MsgBox Err.number 'returns 11.
On Error Resume Next
' x = y \ y
MsgBox Err.number 'returns 0

Any existing error is cleared by the statement. That seems
nonsensical on the surface of it, but it can't work properly
otherwise. If prior errors were not cleared the Err.Number
could not be reliably tested after executing specific code.
If you uncomment the commented line above you still get
error 0, since x = 1 \ 1 is functional code. Yet if On Error
Resume Next did not clear Err.Number you would still be getting
error 11.