Run-time error trapping in VB6

Aquarus
Aquarus used Ask the Experts™
on
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.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2009

Commented:
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
Top Expert 2009

Commented:
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")

Author

Commented:
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
Top Expert 2009
Commented:
Ya know, I've gotten the Automation Error a few times. Sometimes when a needed OCX isn't installed. other times when a user puts my program in the Startup folder, and it starts before Windows has a chance to fully "come up" and load all its stuff (mainly my OCX!).
If that is no where close to your problem, maybe the behind-the-scenes scenario is. Try some delays before doing the section(s) of code that generate this error.

Author

Commented:
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

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial