error handler

error handler

Anonymous
Not applicable
464 Views
3 Replies
Message 1 of 4

error handler

Anonymous
Not applicable
This is more of a VB question....
Is there a way that when in a FOR loop we have an error, we can GOTO next index. ON ERROR RESUME NEXT will go to the next statement, but that is not what I want. I need to ignor this index and go to NEXT N. Is there a syntax to do this?
0 Likes
465 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
How about placing the code with a IF loop where you
check for the error. For ex:

 

For loop.......................

On Error Resume Next

........

........

If Not Err then

.........

........

........

Else

    Err.Clear

EndIf

 

Next

 

Cheers,

Thilak


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
This
is more of a VB question....
Is there a way that when in a FOR loop we
have an error, we can GOTO next index. ON ERROR RESUME NEXT will go to the
next statement, but that is not what I want. I need to ignor this index and go
to NEXT N. Is there a syntax to do this?
0 Likes
Message 3 of 4

Anonymous
Not applicable
If I understand you correctly, check out this
simple code for example

 

on error resume next

a = 0

for i= 0 to
7

  a = a + i

  if a > 5 then goto OUT1

next

 

OUT1:

 

Not great code, but hope this helps (if I
understood)

 

Good Luck!

 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
This
is more of a VB question....
Is there a way that when in a FOR loop we
have an error, we can GOTO next index. ON ERROR RESUME NEXT will go to the
next statement, but that is not what I want. I need to ignor this index and go
to NEXT N. Is there a syntax to do this?
0 Likes
Message 4 of 4

Anonymous
Not applicable
On Error Goto Skip
For i = 0 to n

' Do some stuff that might error

Skip:
Next i
--
John Goodfellow
irtfnm
use john at goodfellowassoc dot com


"farnaz" wrote in message
news:[email protected]...
This is more of a VB question....
Is there a way that when in a FOR loop we have an error, we can GOTO next
index. ON ERROR RESUME NEXT will go to the next statement, but that is not
what I want. I need to ignor this index and go to NEXT N. Is there a syntax
to do this?
0 Likes