G
Guest
Anybody have any ideas how to "select" an item in a multi-select listbox
through code in Access 2000?
I have a listbox that displays a bunch of items, in a particular sort order.
I have buttons to the side of the listbox to move the selected item up/down
the list. The first thing I do is get the value from the bound column of the
currently selected item (I tried to do this without the reference to the
column, but the list itself had a value of null). I then pass a value to a
subroutine which updates the sequence number of the selected item and the one
that is above or below it in the list (executes a couple of sql commands to
update the underlying data table). I then requery the listbox and try to set
the value of the list back to its original value so I can just hit the
up/down arrows again.
CurrentID = me.lst_myList.column(0)
Call ChangeListSequence(-1)
me.lst_myList.requery
me.lst_myList.value = CurrentID
The problem is that when I try to set the value of the list, the does not
seem to work. If I change the multi-select property of the list to None (0),
this works, but I need the multi-select aspect of the list for other
purposes. I even tried changing the multi-select property in code, but it
gives me an error. I even looped through all the items in the list and
turned the selected property off for all but the item I was interested in,
but although this visually selected the item, the next time I clicked on the
up/down arrow, the line that references the value of the column returned a
NULL value and errored out.
through code in Access 2000?
I have a listbox that displays a bunch of items, in a particular sort order.
I have buttons to the side of the listbox to move the selected item up/down
the list. The first thing I do is get the value from the bound column of the
currently selected item (I tried to do this without the reference to the
column, but the list itself had a value of null). I then pass a value to a
subroutine which updates the sequence number of the selected item and the one
that is above or below it in the list (executes a couple of sql commands to
update the underlying data table). I then requery the listbox and try to set
the value of the list back to its original value so I can just hit the
up/down arrows again.
CurrentID = me.lst_myList.column(0)
Call ChangeListSequence(-1)
me.lst_myList.requery
me.lst_myList.value = CurrentID
The problem is that when I try to set the value of the list, the does not
seem to work. If I change the multi-select property of the list to None (0),
this works, but I need the multi-select aspect of the list for other
purposes. I even tried changing the multi-select property in code, but it
gives me an error. I even looped through all the items in the list and
turned the selected property off for all but the item I was interested in,
but although this visually selected the item, the next time I clicked on the
up/down arrow, the line that references the value of the column returned a
NULL value and errored out.