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

Listbox Problem

Status
Not open for further replies.

Tronsliver

Technical User
Sep 19, 2000
120
US
OK I'm struggling. I inserted a listbox on a form named "ExcessListBox." I then opened the form module and inserted this code in a procedure (button Click)to add an item to the list box:

Me!ExcessListBox.AddItem = ab (ab is a string variable that had a string assigned)

When I run the program I get a run time error 438 with the message "Object doesn't support this property or method"

When I debug the yellow error bar shows up on the code shown Me!ExcessListBox.AddItem

Appreciate any input :) thanks
 
Hi!

The Access list box doesn't support the AddItem method. You can use this code:

Me!ExcessListBox.RowSource = Me!ExcessListBox.RowSource & "ab"

This will work if the row source is a value list. If it is a table or query then add ab to the appropriate table and use:

Me!ExcessListBox.Requery

hth


Jeff Bridgham
bridgham@purdue.edu
 
Jebry,

I tried your solution and no error messsage but nothing showed up in the list box ?
 
Hi!

Try it like this:

If IsNull(Me!ExcessListBox.RowSource) = True Then
Me!ExcessListBox.RowSource = "ab"
Else
Me!ExcessListBox.RowSource = Me!ExcessListBox.RowSource & "ab"
End If

hth


Jeff Bridgham
bridgham@purdue.edu
 
Somthing is not working right ? Here are my steps: I added the listbox and didn't change any of the properties. I then added the code you gave to a button click procedure. Again nothing shows up. No error and the code is executed but no text shows in the box.
 
Hi!

Have you set the RowSourceType to Value List? I can't think of anything else off the top of my head.

hth


Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top