View Full Version : Automation Error - Object has diconnected from Clients
ajames420
08-24-2007, 01:12 PM
I was told from another forum that you maybe able to help me here. I searched around the site for info but could not find anything.
Here is my issue:
I have added a calender to a UserForm so that the user does not have to hand type a date. When you click on the combo box to open the calendar this comes up:
Run-time error '-2147417848(80010108)':
Automation Error - Object has diconnected from Clients
I have no idea what that means and I read through this article:
support. microsoft. com/default...; en-us; Q319832
And it makes completely no sense to me. Can someone assist me with my issue?
I have attached the file. Click on the Button on the top left to open the entry form and just click on Arrival Date Combo box.
Thanks
malik641
08-24-2007, 02:00 PM
Hi ajames420, welcome to VBAX
The calendar control works if you do not click the actual Drop-down button on the combo box, but not when you click the actual button. I'm not sure exactly why, though.
You could just make the date field a textbox and use the calendar that way, or you can change the existing code as follows:
Take the code out of the _MouseDown event and place it into the cboDate_Enter event:
Private Sub cboDate_Enter()
Set cboOriginator = cboDate
ocxCalendar.Visible = True
ocxCalendar.SetFocus
If Not IsNull(cboOriginator) Then
ocxCalendar.Value = cboOriginator.Value
Else
ocxCalendar.Value = Date
End If
End Sub Now Comment out the cboOriginator.SetFocus (it's recursive code for the _Enter event):
Private Sub ocxCalendar_Click()
cboOriginator.Value = ocxCalendar.Value
'cboOriginator.SetFocus
ocxCalendar.Visible = False
Set cboOriginator = Nothing
End Sub
Personally, I would use the text box instead.
Good luck!
malik641
08-24-2007, 02:11 PM
By the way, if anybody can explain why the error happened in the first place I'd like to read about it.
Andy Pope
08-25-2007, 02:57 AM
Put the code in the DropButton click event. No automation error and no appearance of the dropdown part of the combo box.
Private Sub cboDate_DropButtonClick()
Set cboOriginator = cboDate
ocxCalendar.Visible = True
ocxCalendar.SetFocus
If Not IsNull(cboOriginator) Then
If IsDate(cboOriginator) Then
ocxCalendar.Value = cboOriginator.Value
Else
ocxCalendar.Value = Date
End If
Else
ocxCalendar.Value = Date
End If
End Sub
ajames420
08-27-2007, 05:31 AM
Andy,
Thank you very much. You know I think I over looked that piece. I actually thought I had it in there already. I am so used to putting those calendars in Access by selecting Drop Down that I completely missed it in Excel.
Thank you again for all of your help. You as well Joesph.
malik641
08-27-2007, 07:47 PM
Thanks Andy, I overlooked that event :rolleyes:
ajames420, Glad we could help you :thumb
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.