Display Selected Item in a List Box

  • Thread starter Thread starter Melissa M
  • Start date Start date
M

Melissa M

I have a listbox which whose datasource is a table with 52 records - one for
each week in the fiscal year. The form's OnOpen event triggers a procedure
which caculates the week # of the current date and selects that value in the
listbox. If the listbox's Multi Select property is set to 'None', the
selected value is shown; if Multi Select is either 'Simple' or 'Extended',
the listbox displays the values from the top of the list, not the selected
value.

How do I get it to display my selected value and have Multi Select cative?????
 
This routine will compare each row in the list, select the one the matches
your calculated week number and select it.

Dim lngX

For lngX = 0 to Me.MyListBox.ListCount -1
If Me.MyListBox.ItemData(lngX) = CalculatedWeekNumber Then
Me.MyListBox.Selected(lngX) = True
Exit For
End If
Next lngX
 
Selecting the value is not my problem - displaying it is. The list will only
display the first X number of list values, regardless of what the selected
value is.
 
Display it where?
You question, then is vague. Can you please describe in more detail what it
is you are trying to do?
 
Back
Top