Error Handling

gmatriix

Registered User.
Local time
Today, 10:28
Joined
Mar 19, 2007
Messages
365
Hello All,

This should be simple but anyways....

I am trying to handle some errors of the network is down. If the network is down is I will get a "Call Failed" message box. I tried some error handling and that error message still comes up along with my Msgbox (last)

I am trying to hid the system message box and replace with my own and it is not working right....still showing up.

I have something like this
Code:
On Error GoTo ErrBox

code......blah blah blah

Errhandle:
Exit Sub


ErrBox:
Msgbox "This is an error or whatever"
Resume Errhandle
End Sub

If it errors hide the system error box and replace it with mine.

What am I doing wrong?

Thanks
 
I am trying to hid the system message box and replace with my own and it is not working right....still showing up.

What sort of LOC raises the error? I seem to recall some DoCmd calls which.... pop error boxes unless a line of code to disable them is provided. I am not sure if those pesky boxes obey VBA error handling. I do not execute queries via DoCmd ever, so I only have a vague memory of this possibility of what you are describing.

Also, I will point out sample code in this site's Wiki...

Robust VBA Error Handler
http://www.access-programmers.co.uk/wiki/index.php/Robust_VBA_Error_Handler
 
Do you get an error number?

May something like this will work:

Code:
    On Error GoTo ErrorHandler

   [COLOR="Red"] code here[/COLOR]

ExitHandler:
    Exit Sub

ErrorHandler:
    Select Case Err
    Case [COLOR="Red"]2102[/COLOR]
        MsgBox "Network Connection Failed! ", vbExclamation, ""
        Resume ExitHandler
    Case Else
        MsgBox Err.Description, vbExclamation, "Error #: " & Err.Number
        Resume ExitHandler
    End Select


Catalina
 
Catalina thanks.

Your code work but I still get the "odbc call failed" I don't think I can trap that message...I have been looking everywhere.

Thanks
 
Your code work but I still get the "odbc call failed" I don't think I can trap that message...

How about showing what the VBA code is which is generating this error. Perhaps someone will spot something.
 

Users who are viewing this thread

Back
Top Bottom