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

AddItem Method

Status
Not open for further replies.

obheron

Technical User
May 25, 2005
40
US
Does anybody know what the code is for AddItem?

Thanks
 
If you talk about native access combos or list box controls, and you are on version 2002 (xp) or higher, then you should easily find it in the help files. It became available in that version, and is not found in prior versions.

Roy-Vidar
 
Examples from Access' VBA help file
This example adds an item to the end of the list in a list box control. For the function to work, you must pass it a ListBox object representing a list box control on a form and a String value representing the text of the item to be added.
Code:
Function AddItemToEnd(ctrlListBox As ListBox, _
        ByVal strItem As String)

    ctrlListBox.AddItem Item:=strItem

End Function
This example adds an item to the beginning of the list in a combo box control. For the function to work, you must pass it a ComboBox object representing a combo box control on a form and a String value representing the text of the item to be added.
Code:
Function AddItemToBeginning(ctrlComboBox As ComboBox, _
        ByVal strItem As String)

    ctrlComboBox.AddItem Item:=strItem, Index:=0

End Function

Hope this helps.

[pc2]
 
I found it about 2 minutes after I posted. Thanks for the quick responses though!.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top