Listbox help

bobby

Registered User.
Local time
Today, 01:17
Joined
Apr 29, 2004
Messages
28
I am designing a form that is interacting with some data in some tables.

I have a combo box, where a user selects what they want. Then the select another value from a combo box next to it. I want to add these two values to a listbox, one value in one column, and one value in another.

I have considered using a listview box, but when i type listview. in the vba program of access, there is no listitems option or add option.

Any suggestions?
 
Do you just want to display the selected values in the listbox? Without storing them in a table somewhere?

Then you can set the rowsource type of the listbox to Value List, make sure the listbox has two columns, and use some code like:
Code:
Me.listbox1.RowSource = Me.listbox1.RowSource & ";new;value"
 
Ok Thanks. That worked. However, i now need to know how to reference it.

How do i say i get the value of an item. Lets say my 2-column list box looks like this:

Apples 10p
Bananas 30p
Oranges 50p

How do i getthe value 30p or the value Oranges from the list box ?
 
Oh Also, how do you clear a combo box.

Basically I am doing a system for a sports database. Team A play Team B. Some players score some goals.

The user selects the number of goals the team scored. Then they must enter how many goals each indivual player scored. This is done via a combo box. So the combo box has the values 1-how ever many goals were scored by the team.

This works, except when the user changes the value of the team goals for the seocnd time, then the combo box changes to :

1
2
3
1
2
3
4
5

If you know what i mean. Hope you do .
 
bobby said:
Ok Thanks. That worked. However, i now need to know how to reference it.

How do i say i get the value of an item. Lets say my 2-column list box looks like this:

Apples 10p
Bananas 30p
Oranges 50p

How do i getthe value 30p or the value Oranges from the list box ?
If this is a regular list box (meaning, not a multiselect listbox), then get the value that has been selected in the listbox by using:
Me.listbox1
 
bobby said:
Oh Also, how do you clear a combo box.
Same as for a listbox (that is not multiselect):
Me.listbox1=Null

Not sure what you're asking with the rest of your post though. :)
 

Users who are viewing this thread

Back
Top Bottom