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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Load Item to combobox

Status
Not open for further replies.

Learnerprog

Programmer
Apr 21, 2004
52
US
Hello all, How to programatically load combobox with items
as in vb I can do this combobox.additem but I dont know how to do this in access vba. Please help.. Thanks.
 
Set the RowSource to something:
Me.cboCombo.RowSourceType = "Table/Query"
Me.cboCombo.RowSource = "Select * From tblTable"

Or

Me.cboCombo.RowSourceType = "Value List"
Me.cboCombo.RowSource = "A;B;C"
 
Hi,

Prior to Access2003, VBA didn't have any equivalent to ComboBox.AddItem As Remou indicated, you either had to add to the control's value list or to the underlying table and then requery the combo box.

If you aren't interested in using Access2003, then there is also another "work around". That is to use array "based" combo boxes with a List Call Back function. You can then add items to the array. Rather a lot more coding, but it is an approach that is ultimately flexible and fast in performance terms.

Cheers,
Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top