Consulting

Results 1 to 6 of 6

Thread: Automation Error - Object has diconnected from Clients

  1. #1

    Automation Error - Object has diconnected from Clients

    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

  2. #2
    Administrator
    2nd VP-Knowledge Base
    VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    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:
    [vba]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[/vba] Now Comment out the cboOriginator.SetFocus (it's recursive code for the _Enter event):
    [vba]Private Sub ocxCalendar_Click()

    cboOriginator.Value = ocxCalendar.Value
    'cboOriginator.SetFocus
    ocxCalendar.Visible = False
    Set cboOriginator = Nothing

    End Sub[/vba]
    Personally, I would use the text box instead.

    Good luck!




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  3. #3
    Administrator
    2nd VP-Knowledge Base VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    By the way, if anybody can explain why the error happened in the first place I'd like to read about it.




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  4. #4
    MS Excel MVP VBAX Mentor Andy Pope's Avatar
    Joined
    May 2004
    Location
    Essex, England
    Posts
    344
    Location
    Put the code in the DropButton click event. No automation error and no appearance of the dropdown part of the combo box.

    [vba]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[/vba]
    Cheers
    Andy

  5. #5
    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.

  6. #6
    Administrator
    2nd VP-Knowledge Base VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    Thanks Andy, I overlooked that event

    ajames420, Glad we could help you




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •