listbox value...

  • Thread starter Thread starter Wayne Heidler
  • Start date Start date
W

Wayne Heidler

I currently have two bound list boxes on a form. The first selects
the main catagory, then the second finds the sub catagory from the
first. (works fine, bit cumbersome) I then store the two seperate values
in separate fields.
What I would like to do is be able to select from the first list box
both the primary and secondary values, then store those values in
seperate fields.
I have tried the .column(2) value, but all that I get with this is
the first record of the primary catagory, even if I selected a different
sub catagory.

ie:
Softball Frank
Softball Joe
Softball Keith
Soccer Sarah
Soccer Timothy

If I select Softball Keith, it will display Softball Frank

Is it possible to do this?

Thanks,
Wayne
 
Hi Wayne,

It would be possible to achieve, but not practical or a good design. Stick
with the two list boxes is my advice!!

Damian.
 
Wayne,

It is possible to do what you are wanting to do.

I assume that you would be able to populate your single listbox with unique
values from the existing data. This would display the two fields in the list
box.

Provided that you have only the two fields in your listbox and the first
field in the Sport and the second field is the Person, then you could use
code like the following to store the values in the two fields:

if not isnull(me.NameOfYourListBox) then
me.NameOfSportTextBox = me.NameOfYourListBox
me.NameOfFirstNameTextBox = me.NameOfYourListBox.column(1)
end if

Where the term "NameOfYourListBox" is just substitute the name of the
listbox control
Where the term "NameOfSportTextBox" is just substitute the name of the
textbox control on your form that is bound to the Sport field
Where the term "NameOfFirstNameTextBox" is just substitute the name of the
textbox control on your form that is bound to the person's name field.
 

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

Back
Top