Remove record from List Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using a listbox to "store" information that the end user enters, so that
I can use the list for query. For instance, the user enters the part number
and quantity in separate text boxes, and then hit the Add Part button. The
part number and quantity are then added to the List Box by using the code:

ListControl.RowSource = ListControl.RowSource & pn & ";" & qty & ";"

My question is how can I set up so that the user can go to the List Box and
click on the list the part nubmer to remove from the list? What' s the
correct code?
Any help is appreciated! Thanks in advance.
Samantha
 
I am using a listbox to "store" information that the end user enters, so that
I can use the list for query.

I'm confused: how are you using this for a query?
For instance, the user enters the part number
and quantity in separate text boxes, and then hit the Add Part button. The
part number and quantity are then added to the List Box by using the code:

ListControl.RowSource = ListControl.RowSource & pn & ";" & qty & ";"

My question is how can I set up so that the user can go to the List Box and
click on the list the part nubmer to remove from the list? What' s the
correct code?
Any help is appreciated! Thanks in advance.
Samantha

Is there any chance you could store this information in a Table, using
a subform, rather than this very unusual technique of using a listbox
to store data?

What you'll need to do is use InStr to find the position of the pn in
the RowSource string, and then use the Mid and Left functions to
extract the rest of the string. It'll get complicated. If your list
box were based on a Table, you could simply delete a table record and
be done.

John W. Vinson[MVP]
 
Back
Top