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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Program ignores ErrorHandler

Status
Not open for further replies.

billybobk

Programmer
Oct 14, 2002
130
US
Why would the ErrrorHandler get ignored, and raise a 'Run-time error' instead?
The code:
========================================
Private Sub cmdDDE_Click()

On Error GoTo ErrorHandler
'other stuff here

ErrorHandler:
Select Case Err.Number
Case 282 ' "Can't find dde conn" error.
MsgBox "Open GoldMine and try again!", vbOKOnly, "Open GoldMine..."
Exit Sub
Case Else

End Select
end Sub
=========================================
This error comes up:
Run time error '282'
no foreign application responded to DDE initiate.
Any ideas? Thanks..

--Bill
One may not reach the dawn save by the path of the night
--Kahlil Gibran
 
Have you got your Error Trapping on the General tab of VB's options set to "Break on All Errors"? If so, try changing it to "Break on Unhandled Errors".


Andy
"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
"Why does my program keep showing error messages every time something goes wrong?"
 
Try using Resume to clear the error once it's been handled, including the Case Else situation:

Private Sub cmdDDE_Click()

On Error GoTo ErrorHandler
'other stuff here

GoTo ExitSub

ErrorHandler:
Select Case Err.Number
Case 282 ' "Can't find dde conn" error.
MsgBox "Open GoldMine and try again!", _
vbOKOnly, "Open GoldMine..."
Resume ExitSub
Case Else
MsgBox "Error " & Foramt$(Err.Number, "#0") & _
" - message: " & Err.Description & _
"." & vbCrLf & "Caused by object: " & _
Err.Source & ".", 16, "System Error"
Resume ExitSub
End Select

ExitSub:

End Sub


Paul Bent
Northwind IT Systems
 
Because you don't handle them. Look, you handle error 282 only (and use exit sub, which is unnecessary).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top