Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Item ComboBox

Status
Not open for further replies.

TMRO

Technical User
Jan 10, 2003
140
CA
Hi everybody!

How can I add items through code to a combobox?
I tryed this
Do Until adorecordset1.EOF
cmbLocation.??? = adorecordset1("Location")
adorecordset1.MoveNext
Loop

But I can't find the additem method like in VB.

Thanks a lot,
TMRO
 
I'm using this syntax becasue I populating the combobox with values from SQL Server.

Thanks again,
TMRO
 
This is out of the help file...


AddItem Method Example

This example adds a combo box control to a command bar. Two items are added to the control, and the number of line items and the width of the combo box are set.

Set myBar = CommandBars("Custom")
Set myControl = myBar.Controls.Add(Type:=msoControlComboBox, Id:=1)
With myControl
.AddItem "First Item", 1
.AddItem "Second Item", 2
.DropDownLines = 3
.DropDownWidth = 75
.ListHeaderCount = 0
End With

Jeremy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top