By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,139 Members | 1,207 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,139 IT Pros & Developers. It's quick & easy.

ComboBox.Dropdown only works sometimes

P: 675
I have a subroutine to dropdown the list portion of a ComboBox.
Expand|Select|Wrap|Line Numbers
  1. Private Sub QuickShow()
  2. 'Display Quick Dropdown ListBox
  3.     cboQuick = cboQuick.DefaultValue
  4.     cboQuick.SetFocus
  5.     cboQuick.Dropdown
  6. 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()

Expand|Select|Wrap|Line Numbers
  1. Private Sub cboQuick_Click()
  2.    . . .
  3.     Call QuickShow
  4. 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?
Feb 14 '09 #1
Share this Question
Share on Google+
1 Reply

P: 675
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.

Feb 14 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.