Re: Err object spontaneously resetting
From: Bob O`Bob (filterbob_at_yahoogroups.com)
Date: 10/21/04
- Previous message: Andreas J: "VB6 application crashing on win2k servers"
- In reply to: Steve: "RE: Err object spontaneously resetting"
- Next in thread: Steve: "Re: Err object spontaneously resetting"
- Reply: Steve: "Re: Err object spontaneously resetting"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 21 Oct 2004 12:27:23 -0700
Steve wrote:
>>MyFunction_Err:
>> If Err.Number = 5 Then
>> ' Handle this error
>> ElseIf Err.Number = -2147221486 Then
>> ' Resume the code at a sensible point
>> Else
>> ' Do something else
>> End If
>>End Function
>>
>>So something happens to cause an error (in this case the DLL tries to
>>retrieve an item from a collection that doesn't exist - the code is set-up to
>>handle this, but the act of trying to retrieve the item causes the error),
>>and the code correctly goes to the error handler. As soon as it does the
>>first if statement the Err object resets itself, meaning that the second if
>>that should have caught the error is by-passed and an error is raised
>>unnecessarily.
That's just not how VB works. There's no such thing as "by-passed"
Maybe you're simply not getting the precise err.number that you coded.
What's in the Else clause? Look THERE next. Make that "Do something
else" include a log entry or report of some kind, or at the very least,
a MsgBox.
Bob
--
- Previous message: Andreas J: "VB6 application crashing on win2k servers"
- In reply to: Steve: "RE: Err object spontaneously resetting"
- Next in thread: Steve: "Re: Err object spontaneously resetting"
- Reply: Steve: "Re: Err object spontaneously resetting"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|