I had a Run-time error
'-2147418105 (800100007)': Automation error The object invoked has disconnected from its clients.
which is raised once in a while. I can't relate it to a specific context for this error. The only clue I have is that before using ADO code I never had that error. The implemented pattern was used many times.
I use Excel 2016 32 bits on windows 7 with a vba code.
Private mForm As frmCfgPrjctTm
Public Sub U_CfgPrjctTm_OnOpen()
If (mForm Is Nothing) Then
Call U_UnlockTeam
Set mForm = New frmCfgPrjctTm
End If
'>>>>>> the error occurs after this comment
mForm.Show vbModeless
End Sub
The code to "close" the form is as following
Public Sub U_CfgPrjctTm_OnClose()
If (Not mForm Is Nothing) Then
mForm.Hide
Dim tmp As frmCfgPrjctTm
Set tmp = mForm
Set mForm = Nothing
Unload tmp
End If
End Sub
and in the form code (childCfgPrjctTmSettings and childCfgPrjctTmSettings are defined in an enum to falg a user action before closing the form)
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Call U_UnlockTeam
Select Case CloseMode
Case vbAppWindows, vbAppTaskManager
Call U_CfgPrjctTm_OnClose
Case vbFormControlMenu, vbFormCode
Call Save
Select Case mbOpenForm
Case childCfgPrjctTmSettings
' this opens another form
Call U_Sttngs_OnOpen(delUsr)
Case childCfgPrjctTmUsrId
' this opens another form
Call U_UsrLggd_OnOpen(dpyUsrLggdCfgPrjctTeam)
End Select
End Select
Cancel = False
End Sub
and in the form code
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Call U_UnlockTeam
Select Case CloseMode
Case vbAppWindows, vbAppTaskManager
Call U_CfgPrjctTm_OnClose
Case vbFormControlMenu, vbFormCode
Call Save
Select Case mbOpenForm
Case childCfgPrjctTmSettings
Call U_Sttngs_OnOpen(delUsr)
Case childCfgPrjctTmUsrId
Call U_UsrLggd_OnOpen(dpyUsrLggdCfgPrjctTeam)
End Select
End Select
Cancel = False
End Sub
This error is raised after creating a form and at the very moment to show it up. The call U_UnlockTeam involves some ADO code called inside to retreive data from a data base. The form has no Activate event handler. Did some one have the same issue and how did you cope with ?