Partager via


How to: Display the List Portion of a Combo Box

The following example uses the DropDown method to display the list in a ComboBox. The user can display the list of a ComboBox by clicking the CommandButton.

To use this example, copy this sample code to the Script Editor of a form. To run the code you need to open the form so the Open event will activate. Make sure that the form contains:

  • A ComboBox named ComboBox1.

  • A CommandButton named CommandButton1.

Dim ComboBox1 
 
Sub CommandButton1_Click() 
 ComboBox1.DropDown 
End Sub 
 
Sub Item_Open() 
 Set ComboBox1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("ComboBox1") 
 ComboBox1.AddItem "Turkey" 
 ComboBox1.AddItem "Chicken" 
 ComboBox1.AddItem "Duck" 
 ComboBox1.AddItem "Goose" 
 ComboBox1.AddItem "Grouse" 
End Sub