reset listbox

  • Thread starter Thread starter mcnewsxp
  • Start date Start date
M

mcnewsxp

how can i reset a listbox to unselect empty value.
i have a first row that consists of 0;"";
i use a combobox to locate records and update listbox selections.
if no record is found i need to clear out the list box values.
if i set the listbox value to 0 i can't get out of the combobox's
after_update method.
 
Not sure I understand your setup. Is that first row really required?

If the listbox is not multiselect, you should be able to unselect by
assigning Null to the control:

Me!MyListBox = Null

If the listbox is multiselect, you need to loop through it, setting the
Selected property to False:

Dim intLoop As Integer

For intLoop = 0 To (Me!MyListBox.Listcount - 1)
Me!MyListBox.Selected = False
Next intLoop

(although if you've only got the one row, Me!MyListBox.Selected(0) = False
should be enough)
 
i have several rows, but the user does not want to see any values when
nothing has been selected so i have to reset it.
the problem occurs when i select an item from the combobox that looks up a
record finds the right selection in the listbox id it finds the record
selected in the combobox. if i then make a combobox selection that does not
have a record when i try to reset the listbox.value to 0 or null it gets
stuck in the combobox after_update method and i can't move off of the
combobox.
 
Back
Top