VBA errors how do they work in my example

darbid

Registered User.
Local time
Today, 21:21
Joined
Jun 26, 2008
Messages
1,428
Hi Guys,

I have the following
Code:
private sub doingsomething()
On Error GoTo Err_doingsomething

call XYZ

Exit_doingsomething:
    Exit Sub

Err_doingsomething:
    MsgBox Err.Description & " Error No." & Err.Number
    Resume Exit_doingsomething
end sub
Code:
private sub XYZ()
On Error GoTo Err_XYZ

code here

On Error GoTo Err_LoopB

Err_LoopB:
DoEvents
Err.Clear

code that will produce an error

On Error GoTo Err_XYZ


Exit_XYZ:
    Exit Sub

Err_XYZ:
    MsgBox Err.Description & " Error No." & Err.Number
    Resume Exit_XYZ
end sub
The idea being that in XYZ I loop in that Err_LoopB until it does not error.

I know you are asking why am I doing this - The reason for doing this is that I am waiting for a HTML Document to be ready.

The question is that Err_LoopB seems to only loop 2 and then it goes back to Err_doingsomething and produces the same error message. How can I make it loop more often?
 
you cant , cz error will change to stack overfollow as ms access believes on repetition of error that it is falling within an endless loop.

i would suggest for your quest using the form timer insted , use interval of 1 second then let it loop on failure at check on whatever it is you want to check on or clear the timer on success.
 

Users who are viewing this thread

Back
Top Bottom