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

<b>listbox bound column</b> 1

Status
Not open for further replies.

biot023

Programmer
Nov 8, 2001
403
GB
I have added a field to the rowsource of a list box and changed the bound column to read it (6, as it happens).
Trouble is, when I try to assign that value to my listbox (listTag1=listTag1.Column(5,i)), it reads only a null value.
This is making me hate listboxes, and I don't want to hate listboxes, as they're quite useful.
Any help very gratefully appreciated.
 
I assume from the "i" that you are using a for .. next loop. First, the column property will not take 2 arguments (5,i) it will only take one (5) or (i).

Second, the value of a list box is whatever the bound column is. So to set the value of a listbox, you simply type the following:

Listbox1 = YourValue

If your value is 88, the listbox will find the value 88 in column 6 (the bound column) and select that row.

If this does not help, then post the chunk of code this is included in, so we can get the whole context. Jim Lunde
compugeeks@hotmail.com
We all agree that your theory is crazy, but is it crazy enough?
 
Hi All!

Actually Jim the Column property does take two arguments, but the second one(for the row) is optional. biot023, if your concern is for what the combo box is displaying, then the properties you need to check are columncount and columnwidths. If you want the 6th column displayed, you will need to make the column width of the first five colums 0. Jim is right when he says that it makes no sense to set the value of the list box to the bound column since that is the value already.

hth Jeff Bridgham
bridgham@purdue.edu
 
Jeff,

Thanks for the clarification, I have never used second property. Jim Lunde
compugeeks@hotmail.com
We all agree that your theory is crazy, but is it crazy enough?
 
Are you tring to preset your listbox value?

I just tried to preset a listbox value by:

me!list56 = x

My listbox is set to multiselect = simple and it did not work.

I then changed my listbox to multiselect = none and preformed the same test and it worked to preset the listbox value using the me!list56 = x statement.

I also noticed that when multiselect is set on your list box, to retreive the selected value of the listbox you must use the column(column, varitem) where varitem = .itemselected , and since you can select more then one item it needs to be in a for each .itemselected loop to process more then one response.

Hope this input helps

dave


 
Thanks alot for the responses - I didn't realise that the listbox automatically searched for a valid value when you set it - this actually explains the root of my problem, which was trying to keep my place when moving in and out of focus of the listbox.
Thanks again - I'll be trying out your suggestions today & I'll post the results when I get them.
Cheers, biot023
 
In the end, I redid the form & set the paramaters I'd tried to change in the listbox from fresh. This worked (obviously), but more important has been the use I've had of the knowledge that you can just pass a listbox a value & it automatically finds it & selects it.
This has been really tremendous, thankyou.

Cheers, Douglas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top