Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: How to Open a Combo Box Automatically


View products that this article applies to.

This article was previously published under Q209585
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

↑ Back to the top


Summary

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 pointer. In Microsoft Access, you can use the Dropdown method to force the list in the specified combo box to drop down. Using this method is identical to pressing the F4 key when the control has the focus.

↑ Back to the top


More information

The following steps show how to create a new form with a combo box named EmpLastName that will automatically display the list when you select the combo box.
  1. Open the sample database Northwind.mdb or Access project NorthwindCS.adp.
  2. Create a new form with the following controls:
       Form: MyForm
       ------------------------------
       ControlSource: Employees Table
    
       Text box
       -----------
       Name: Text0
    
       Combo box
       -----------------------------------------------------
       Name: EmpLastName
       Row Source Type: Table/Query or Table/View/StoredProc
       Row Source: SELECT [LastName] FROM Employees;
    
       Command button
       ---------------------------
       Name: Command4
    					
  3. Set the combo box's OnGotFocus property to the following event procedure:
    Private Sub EmpLastName_GotFocus()
       EmpLastName.Dropdown
    End Sub
    					
  4. Open your form in Form view, and press the TAB key to move to your combo box.

↑ Back to the top


References

For more information about the Dropdown method, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type Dropdown method in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

↑ Back to the top


Keywords: KB209585, kbvba, kbprogramming, kbofficeprog, kbhowto, kbdta

↑ Back to the top

Article Info
Article ID : 209585
Revision : 3
Created on : 10/11/2006
Published on : 10/11/2006
Exists online : False
Views : 327