
|
Adding an Item to a List Box It's rather difficult to add an item to an Access list box on the fly. If you need this functionality but would rather skip the extra work, use the Microsoft Forms list box instead of the Access list box. Microsoft Forms controls--and there are several to choose from--are more flexible than the native Access controls. To insert a Microsoft Forms 2.0 ListBox control into your Access form, in Design View, choose Insert, Microsoft Forms 2.0 ListBox, then click OK. Or click More Controls on the Toolbox and select the control from the resulting list. Once you've inserted the control, you can use that control's properties and methods just as you would a native control's properties. One of the Microsoft Forms 2.0 ListBox methods is AddItem, which uses the syntax object.AddItem "item", index The procedure below will add two items to the list box when the form is opened: Sub Form_Open() To remove an item from a list, use the RemoveItem method in the form object.RemoveItem index where index is the position of the item you want to remove (the first item equals 0).
|
||||
| Search RD Techbase | ||||
![]()