[VAB] ListBoxes problem

B

ByB

Hello,

I am developping an Access/VBA application. In this app, I creatd a
from (let call it A) and a subform (let call it B).

The form A has 15 occurences of the subform B in it.

The subform B has a ListBox control, with 3 possible values to display
(arrow up, arrow neutral and arrow down). Let call the ListBox LB.

I need to change the item displayed in the ListBox of each 15
occurences of the subform accordingly to the value of the data found in
the 15 rows of a recordset. Let call the value "myvalue". myvalue is
between 0 and 2.

I tried to make the change in the ListBoxes by using KB.ListItem =
myvalue, but I have an error message saying that it's a bad use of
ListItem.

I tried with LB.Selected(myvalue) = True, but the error message says
that Selected property does not exist.

I tried with LB.SelectedItem = myvalue, and the result is the same.

Can somebody help me and tell me how can I select the item displayed in
the ListBoxes of my subform ? Thank a lot for any help !
 
C

Chay Harley

When you use the listbox object, you need to design it, leaving it empty.

When your form initialises, you need to add the entries to it using

Listbox1.Add "stuff goes here"

You might want to google for some code on how to properly construct
listboxes in forms, there are many examples on the 'net.

Cheers,
Chay Harley.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top