Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use of On Error statement question

Status
Not open for further replies.

aclayborne

Programmer
May 3, 2000
49
US
Here's my code:

On Error GoTo 0
On Error Resume Next

Verify = Dir(SysInfo.AccessDBLocation & "\Access.mdb", vbDirectory)

If Err.Number = 52 Then
Err.Clear
MsgBox ("Database path is invalid!")
End If

I've been reading other articles posted on the use of the "On Error" statement are the first two lines of my code redundant?
What is the scope of the On Error?
Once you turn the error trapping off is it turned back on after the particular procedure is exited.
Does it need to be call more than once in a procedure?

 
Normally the scope of an On Error is only the procedure where the On Error is located. It will reset when you get out of the procedure.

By the way: you can use labels like in this example:

private sub MySub()
on error goto err_handle

statements

err_handle:
'Type your error handling statement here.
end sub

Succes!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top