Quote Originally Posted by michelle

Can you pls tell me how to fill my combobox and what properties I have to set for the combobox.

This doesn''t work!
 With ComboBox1 
    .AddItem "Create Button", 1
    .AddItem "Remove Button", 2
End With
Provided that ComboBox1 is a valid object and your .RowSourceType = "Value List", this method of adding items to a ComboBox or ListBox will work with a small adjustment.

Quote Originally Posted by Microsoft
Syntax:

Variant = object.AddItem [ item [, varIndex]]

Part Description

object Required. A valid object.

Item Optional. Specifies the item or row to add. The number of the first item or row is 0; the number of the second item or row is 1, and so on.

varIndex Optional. Integer specifying the position within the object where the new item or row is placed.
Your problem is you're trying to add an item to the second row in the column before anything has been placed into the first row. Just change to this:

 With ComboBox1 
    .AddItem "Create Button", 0
    .AddItem "Remove Button", 1
End With
Or this, which is the same thing

 With ComboBox1 
    .AddItem "Create Button"
    .AddItem "Remove Button"
End With
Or this, which is a variation that changes the order of the items (puts both into the top position, meaning that "Create Button" goes to the top first, but then it's moved down to the second position when "Remove Button" is put at the top)

 With ComboBox1 
    .AddItem "Create Button", 0
    .AddItem "Remove Button", 0
End With
To get the list index value the user chooses, add this to your with statement:

 With ComboBox1 
    .AddItem "Create Button"
    .AddItem "Remove Button"
    .BoundColumn = 0
End With
If a user chooses "Create Button", then you can get the list index value (which is 0 in this case) with this:

ComboBox1.Value
These things said, there are much easier ways to populate a ComboBox in Access. As Norie already mentioned, the most common way is to load data from a table, and after reading your first post, it sounds like that's what you want to do.

 With ComboBox1 
    .RowSourceType = "Table/Query"
    .RowSource = "TableOrQueryName"
    .ColumnCount = 2
    .ColumnWidths = "0;"
End With
Make sure your table or query has the ID as its first field (in the first column), and have the text you want to load to the combobox be in the adjacent field/column. The setting .ColumnWidths="0;" means that the first column will be 0 inches wide, which will hide it.

I hope this helps!

P.S. For reference: http://msdn.microsoft.com/library/de...HV03079828.asp