AddItem and RemoveItem methods are unavailable for listbox

I cannot seem to gain access to the methods addItem and removeItem for a listbox in Access 2000 VBA.

The error I get is: "Compile error: Method or data member not found".

I figure its as simple as going to Tools | References and selecting the proper reference, but I can't seem to figure it out - especially since the same program worked fine at work.

Any ideas?
LVL 6
PlamodoAsked:
Who is Participating?
 
shanesuebsahakarnConnect With a Mentor Commented:
AFAIK AddItem and RemoveItem cannot be used for form list boxes in Access 2000 (but I could be wrong about this). They are only relevant to command bar combo boxes, although they can be used to add items to list boxes in Access XP.

You may need to use other methods to add information to your list box, such as manually appending your data to the RowSource (if it is a value list):
Me!ListBox0.RowSource = Me!ListBox0.RowSource & ";SomeData"
0
 
AceDefabulCommented:
AddItem and RemoveItem aren't part of the Listbox object
until Access 2002. Even then I think they are limited in the same way a ValueList is limited.

You might be interested in this article explaining how to write a class to add these two methods to a listbox or combobox in versions prior to 2002.

http://www.fmsinc.com/tpapers/97classes/index.html
0
 
RobaJobCommented:
AddItem and RemoveItem are methods of the ActiveX list box

Insert ActiveX Control: Microsoft Foroms 2.0 Listbox

hth
0
 
PlamodoAuthor Commented:
Thanks.  The manual input idea is a good one, but I think the best solution is just to update my version of Access.
0
All Courses

From novice to tech pro — start learning today.