Doesn't work. The listbox has the correct value, it just doesn't move to
the highlighed record.
I have
LB.Value = sValue
The bound column is a string data type
Per your suggestion, I tried
With LB
.Value = .ItemData(.ListIndex)
End With
The resule is the same. No matter how the value is calculated on the right
hand side of "=", it's still assigning a string to the lb value property.
Per your comments:
If users only want to select one record at a time, they can. There are some
functions that users can do on multiple records - that's why it's
multi-select. If a user selects more that one record, most of the form
controls - (the navigation buttons and the fields in particular) become
disabled and only the command buttons that perform those functions mentioned
earlier remain enabled. The form is totally unbound, that's why the value
list. I could bind the lb to a disconnected recordset, but value lists
perform better.
I do thank you for your suggestion.
"Jamey Shuemaker" <ca*********@yahoo.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...
Try setting the listboxes Value property to ItemData(x) where x is the
row you want to set.
On another note, you may want to set the MultiSelect prop for this
listbox to "None" if you are only using this listbox for record
navigation. There's no need to allow the user to select more than one
item in the listbox, and by extension, more than one record in the
recordset.
Also not clear on why you are using a "Value List" RowSourceType. If
you have a value in the list for every record in the table you're
drawing your records from, wouldn't it be more efficient to set the
RowSourceType to "Table/Query" and provide a RowSource?
Matthew Wells wrote:
I have a listbox set to simple multi select. For this example, users
only
select one item at a time. I have command buttons on the form for
First,
Previous, Next, Last, New (record). The form and listbox are unbound.
The
listbox rowsource is a value list. The list box has about sixty items
in
it. Each item in the list box corresponds to a record in the database.
When a user selects a row in the list box, the record is retrieved. The
same thing for if one of the command buttons is clicked. The problem is
that if I'm on the first record and I select the "Last" command button,
everything works fine except I can't see the highlighted last row of the
listbox. If I scroll down the listbox, the last row is correctly
highlighted, I just don't jump to it when "Last" is clicked.
My code is something like this: (Assume I'm on the first record then
clicking "Last"
MyListbox.Selected(1) = False
MyListbox.Selected(60) = True
How do I make the last row visible?
Thanks.
Matthew Wells
MW****@FirstByte.net