Link to home
Start Free TrialLog in
Avatar of Aquarus
Aquarus

asked on

Run-time error trapping in VB6

I am receiving a
Run -time error '2147418107(80010005)'
Automation error
It is illegal to call out while inside message filter

I need to catch this prticular error number with a friendly message: "System is busy.  Please try later"

Help me please with a code for the error handler, and its position on the form.
Detail of this error that it happens somewhere either on the AFterEdit  event of the certaiin column of the flex grid.  This column is a combobox type. Or on the BeforeEdit of another column that is also combo box type.
Avatar of VBClassicGuy
VBClassicGuy
Flag of United States of America image

Private Sub SomeRoutine
   Dim ErrorText As String
   On Local Error Go To Hell
...
code here
....
   Exit Sub
Hell:
   ErrorText = "Error Number: " & vbCrLf & Err.Number & vbCrLf & "Description: " & vbCrLf & Err.Description
   MsgBox(ErrorText, vbCritical, "ERROR")
End Sub
Opps, I see you have specific requirements. Instead, use:
Hell:
   If Err.Number = 2147418107 Then
      ErrorText = "System is busy.  Please try later"
   Else
      ErrorText = "Error Number: " & vbCrLf & Err.Number & vbCrLf & "Description: " & vbCrLf & Err.Description
   End If
   
MsgBox(ErrorText, vbCritical, "ERROR")
Avatar of Aquarus
Aquarus

ASKER

VbClassicGuy:
Every event/sub/function on the form and grids has its error trapper with the name of where the error has happend.
I have put your code in a few functions/events where the error seemingly happened.  And it show up again - without being trapped.
I am begginning to wonder if this type of automation errors are really trappable?
ANyway I still working
ASKER CERTIFIED SOLUTION
Avatar of VBClassicGuy
VBClassicGuy
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aquarus

ASKER

Thank you VClassicGuy:
I put the trap every where I could possibly think of.  It helped a liitle, but the error is still hunting. I understood the line of thinking you are suggesting.  Thenk youvery much