I developed quite a usercontrol and used for a while, no problem.

But suddenly user report an error (Automation Error), and then I insert On Error statement for all subroutine etc in the User Control.

And the user control displayed a unique error and then it seems I narrowed down to a particular Sub. BUT... I don't know why it has error

Private Sub Code_GotFocus()

On Error Goto Err_CodeGotFocus

If Len(Code.Text) <> 0 Then
Code.SelStart = 0
Code.SelLength = Len(Code.Text)
End If

Exit Sub

Err_CodeGotFocus:

MsgBox "CodeGotFocus:" & Str$(Err) & " " & Error$(Err)

End Sub


I got the display when running the parent program

CodeGotFocus: 400 Automation Error


WHY??????


Please help