ACC: How to Open a Combo Box Automatically

Last reviewed: May 14, 1997
Article ID: Q98225
The information in this article applies to:
  • Microsoft Access versions 1.0, 1.1, 2.0, 7.0, 97

SUMMARY

Moderate: Requires basic macro, coding, and interoperability skills.

When you are entering a large amount of data and want to open a combo box, it is inconvenient to have to press additional keys or stop to use the mouse. This article presents a generic macro that opens a combo box when you set the focus on the control by pressing the TAB key.

In Microsoft Access 7.0 and 97, you can use the Dropdown method to force the list in the specified combo box to drop down. If the specified combo box control does not have the focus, an error occurs. Using this method is identical to pressing the F4 key when the control has the focus.

MORE INFORMATION

A macro with a single action, SendKeys, is shown below. You can use this macro for all combo boxes on your form:

  1. Create a macro called Open Combo Box, as follows:

          Action
          --------
          SendKeys
    

          Actions Arguments
          ------------------
          Keystrokes: %{DOWN}
          Wait: Yes
    

  2. Open your form in Design view.

  3. Add the above macro to the OnEnter property of your combo box.

  4. Open your form in Form view, and use the TAB key to move to your combo box.

Using the Dropdown Method in Microsoft Access 7.0 and 97

  1. Create a new form

  2. Add a combo box and a text box control to the form

  3. Set the combo box's OnGotFocus property to the following event procedure:

          Private Sub Employees_GotFocus()
           Me!ComboBoxName.Dropdown
          End Sub
    

  4. Open your form in Form view, and use the TAB key to move to your combo box.

REFERENCES

For more information about the Dropdown method, search the Help Index for "Dropdown method," or ask the Microsoft Access 97 Office Assistant.

For more information about automatically sending keystrokes, search the Help Index for "SendKeys," or ask the Microsoft Access 97 Office Assistant.


Additional query words: send keys
Keywords : FmsCmbo kbusage
Version : 1.0 1.1 2.0 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbhowto


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 14, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.