ComboBox.Dropdown only works sometimes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • OldBirdman
    Contributor
    • Mar 2007
    • 675

    ComboBox.Dropdown only works sometimes

    I have a subroutine to dropdown the list portion of a ComboBox.
    Code:
    Private Sub QuickShow()
    'Display Quick Dropdown ListBox
        cboQuick = cboQuick.DefaultValue
        cboQuick.SetFocus
        cboQuick.Dropdown
    End Sub 'QuickShow
    It works from anywhere it is called from, either Event subroutines or from other functions and/or subroutines. Except from one event sub, cboQuick_Click( )

    Code:
    Private Sub cboQuick_Click()
       . . .
        Call QuickShow
    End Sub 'cboQuick_Click
    I can step through the code, and at the line End Sub 'cboQuick_Click the dropdown is removed, the list vanishes. It is there, and the downarrow will display it, but not automatically. I can put the line Call QuickShow as the last line of any other subroutine, and it works fine.
    Any suggestions here?
  • OldBirdman
    Contributor
    • Mar 2007
    • 675

    #2
    So Access knows it is in the Click Event, and the normal end is to hide the list. So how do I stop the code before it can reach the end statement. Exit Sub doesn't do it. Stop only suspends execution.
    I tried as the last line cmdX.SetFocus and then using the GotFocus event of cmdX to display the list, but Access gets Run-time error '2110' Can't move focus to the control cmdX. Don't know why not, perfectly valid control, visible, enabled, spelled correctly, and all that.

    OK - problem solved. Caption of cmdX is &Button and I use the SendKeys"%B") to give the focus to cmdX. I will make this control too small to see, but visible.

    There is nothing like trying to present a clear problem to this forum to clarify thinking, reduce the problem to its essentials, and perhaps find an answer.

    OldBirdman

    Comment

    Working...